RevertToRevision() public méthode

public RevertToRevision ( FilePath localPath, MonoDevelop.VersionControl.Revision revision, MonoDevelop.Core.ProgressMonitor monitor ) : void
localPath FilePath
revision MonoDevelop.VersionControl.Revision
monitor MonoDevelop.Core.ProgressMonitor
Résultat void
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);
                }
            }
            protected override void Run()
            {
                // 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;
                }

                Monitor.ReportSuccess(GettextCatalog.GetString("Revert operation completed."));
                Gtk.Application.Invoke(delegate {
                    if (!isDir)
                    {
                        // Reload reverted files
                        Document doc = IdeApp.Workbench.GetDocument(path);
                        if (doc != null)
                        {
                            doc.Reload();
                        }
                        VersionControlService.NotifyFileStatusChanged(vc, path, false);
                        FileService.NotifyFileChanged(path);
                    }
                    else
                    {
                        VersionControlService.NotifyFileStatusChanged(vc, path, true);
                    }
                });
            }