Example #1
0
        protected void OnGetOutgoing()
        {
            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);

            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, false, false, false);
            try {
                if ((int)Gtk.ResponseType.Ok == bsd.Run())
                {
                    MercurialTask worker = new MercurialTask();
                    worker.Description = string.Format("Outgoing to {0}", bsd.SelectedLocation);
                    worker.Operation   = delegate {
                        repo.LocalBasePath = MercurialRepository.GetLocalBasePath(localPath);
                        Revision[] history = repo.GetOutgoing(bsd.SelectedLocation);
                        DispatchService.GuiDispatch(() => {
                            var view = new MonoDevelop.VersionControl.Views.LogView(localPath, true, history, repo);
                            IdeApp.Workbench.OpenDocument(view, true);
                        });
                    };
                    worker.Start();
                }
            } finally {
                bsd.Destroy();
            }
        } // OnGetOutgoing