Revert() 공개 메소드

public Revert ( FilePath localPaths, bool recurse, MonoDevelop.Core.ProgressMonitor monitor ) : void
localPaths FilePath
recurse bool
monitor MonoDevelop.Core.ProgressMonitor
리턴 void
예제 #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);
                    }
                });
            }