MonoDevelop.VersionControl.Repository.Revert C# (CSharp) Méthode

Revert() public méthode

public Revert ( FilePath localPaths, bool recurse, MonoDevelop.Core.ProgressMonitor monitor ) : void
localPaths FilePath
recurse bool
monitor MonoDevelop.Core.ProgressMonitor
Résultat void
		public void Revert (FilePath[] localPaths, bool recurse, ProgressMonitor monitor)
		{
			ClearCachedVersionInfo (localPaths);
			OnRevert (localPaths, recurse, monitor);
		}

Usage Example

Exemple #1
0
            protected override void Run()
            {
                try {
                    // A revert operation can create or remove a directory, so the directory
                    // check must be done before and after the revert.

                    bool isDir = Directory.Exists(path);

                    if (toRevision)
                    {
                        //we discard working changes (we are warning the user), it's the more intuitive action
                        vc.Revert(path, true, Monitor);

                        vc.RevertToRevision(path, revision, Monitor);
                    }
                    else
                    {
                        vc.RevertRevision(path, revision, Monitor);
                    }

                    if (!(isDir || Directory.Exists(path)))
                    {
                        isDir = false;
                    }

                    Gtk.Application.Invoke((o, args) => {
                        if (!isDir)
                        {
                            // Reload reverted files
                            Document doc = IdeApp.Workbench.GetDocument(path);
                            if (doc != null)
                            {
                                doc.Reload();
                            }
                            VersionControlService.NotifyFileStatusChanged(new FileUpdateEventArgs(vc, path, false));
                        }
                        else
                        {
                            VersionControlService.NotifyFileStatusChanged(new FileUpdateEventArgs(vc, path, true));
                        }
                    });
                    Monitor.ReportSuccess(GettextCatalog.GetString("Revert operation completed."));
                } catch (Exception ex) {
                    LoggingService.LogError("Revert operation failed", ex);
                    Monitor.ReportError(ex.Message, null);
                }
            }
All Usage Examples Of MonoDevelop.VersionControl.Repository::Revert