Пример #1
0
        public static void Push(MercurialRepository repo)
        {
            var dlg = new PushDialog(repo);

            try {
                if (MessageService.RunCustomDialog(dlg) != (int)Gtk.ResponseType.Ok)
                {
                    return;
                }

                string remote = dlg.SelectedRemote;
                string branch = dlg.SelectedRemoteBranch;

                IProgressMonitor monitor = VersionControlService.GetProgressMonitor(GettextCatalog.GetString("Pushing changes..."));
                System.Threading.ThreadPool.QueueUserWorkItem(delegate {
                    try {
                        repo.Push(monitor, remote, branch);
                    } catch (Exception ex) {
                        monitor.ReportError(ex.Message, ex);
                    } finally {
                        monitor.Dispose();
                    }
                });
            } finally {
                dlg.Destroy();
            }
        }
Пример #2
0
        protected void OnMercurialPublish()
        {
            VersionControlItem              vcitem   = GetItems()[0];
            MercurialRepository             repo     = ((MercurialRepository)vcitem.Repository);
            Dictionary <string, BranchType> branches = repo.GetKnownBranches(vcitem.Path);
            string defaultBranch = string.Empty,
                   localPath     = vcitem.IsDirectory? (string)vcitem.Path.FullPath: Path.GetDirectoryName(vcitem.Path.FullPath);

            if (repo.IsModified(MercurialRepository.GetLocalBasePath(vcitem.Path.FullPath)))
            {
                MessageDialog md = new MessageDialog(MonoDevelop.Ide.IdeApp.Workbench.RootWindow, DialogFlags.Modal,
                                                     MessageType.Question, ButtonsType.YesNo,
                                                     GettextCatalog.GetString("You have uncommitted local changes. Push anyway?"));
                try {
                    if ((int)ResponseType.Yes != md.Run())
                    {
                        return;
                    }
                } finally {
                    md.Destroy();
                }
            }            // warn about uncommitted changes

            foreach (KeyValuePair <string, BranchType> branch in branches)
            {
                if (BranchType.Parent == branch.Value)
                {
                    defaultBranch = branch.Key;
                    break;
                }
            }            // check for parent branch

            Dialogs.BranchSelectionDialog bsd = new Dialogs.BranchSelectionDialog(branches.Keys, defaultBranch, localPath, false, true, true, true);
            try {
                if ((int)Gtk.ResponseType.Ok == bsd.Run() && !string.IsNullOrEmpty(bsd.SelectedLocation))
                {
                    MercurialTask worker = new MercurialTask();
                    worker.Description = string.Format("Pushing to {0}", bsd.SelectedLocation);
                    worker.Operation   = delegate { repo.Push(bsd.SelectedLocation, vcitem.Path, bsd.SaveDefault, bsd.Overwrite, bsd.OmitHistory, worker.ProgressMonitor); };
                    worker.Start();
                }
            } finally {
                bsd.Destroy();
            }
        }        // OnPublish
        public static void Push(MercurialRepository repo)
        {
            var dlg = new PushDialog (repo);
            try {
                if (MessageService.RunCustomDialog (dlg) != (int) Gtk.ResponseType.Ok)
                    return;

                string remote = dlg.SelectedRemote;
                string branch = dlg.SelectedRemoteBranch;

                IProgressMonitor monitor = VersionControlService.GetProgressMonitor (GettextCatalog.GetString ("Pushing changes..."));
                System.Threading.ThreadPool.QueueUserWorkItem (delegate {
                    try {
                        repo.Push (monitor, remote, branch);
                    } catch (Exception ex) {
                        monitor.ReportError (ex.Message, ex);
                    } finally {
                        monitor.Dispose ();
                    }
                });
            } finally {
                dlg.Destroy ();
            }
        }