Esempio n. 1
0
        protected void OnRebase()
        {
            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, true, true, false);
            try {
                if ((int)Gtk.ResponseType.Ok == bsd.Run() && !string.IsNullOrEmpty(bsd.SelectedLocation))
                {
                    MercurialTask worker = new MercurialTask();
                    worker.Description = string.Format("Rebasing on {0}", bsd.SelectedLocation);
                    worker.Operation   = delegate { repo.Rebase(bsd.SelectedLocation, vcitem.Path, bsd.SaveDefault, bsd.Overwrite, worker.ProgressMonitor); };
                    worker.Start();
                }
            } finally {
                bsd.Destroy();
            }
        }        // OnRebase
Esempio n. 2
0
        protected void OnUncommit()
        {
            VersionControlItem  vcitem = GetItems()[0];
            MercurialRepository repo   = (MercurialRepository)vcitem.Repository;

            MercurialTask worker = new MercurialTask();

            worker.Description = string.Format("Uncommitting {0}", vcitem.Path);
            worker.Operation   = delegate { repo.Uncommit(vcitem.Path, worker.ProgressMonitor); };
            worker.Start();
        }        // OnUncommit
Esempio n. 3
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
Esempio n. 4
0
 protected override void Run()
 {
     Dialogs.BranchSelectionDialog bsd = new Dialogs.BranchSelectionDialog(new List <string>(), string.Empty, Environment.GetFolderPath(Environment.SpecialFolder.Personal), true, false, false, false);
     try {
         if ((int)Gtk.ResponseType.Ok == bsd.Run() && !string.IsNullOrEmpty(bsd.SelectedLocation))
         {
             string branchLocation = bsd.SelectedLocation,
                    branchName     = GetLastChunk(branchLocation),
                    localPath      = Path.Combine(bsd.LocalPath, (string.Empty == branchName)? "branch": branchName);
             MercurialTask worker  = new MercurialTask();
             worker.Description = string.Format("Branching from {0} to {1}", branchLocation, localPath);
             worker.Operation   = delegate { DoBranch(branchLocation, localPath, worker.ProgressMonitor); };
             worker.Start();
         }
     } finally {
         bsd.Destroy();
     }
 }
Esempio n. 5
0
        protected void OnResolve()
        {
            List <FilePath>     files = null;
            MercurialRepository repo  = null;

            foreach (VersionControlItemList repolist in GetItems().SplitByRepository())
            {
                repo  = (MercurialRepository)repolist[0].Repository;
                files = new List <FilePath> (repolist.Count);
                foreach (VersionControlItem item in repolist)
                {
                    files.Add(new FilePath(item.Path));
                }

                MercurialTask worker = new MercurialTask();
                worker.Description = string.Format("Resolving {0}", files[0]);
                worker.Operation   = delegate { repo.Resolve(files.ToArray(), true, worker.ProgressMonitor); };
                worker.Start();
            }
        }        // OnResolve
Esempio n. 6
0
        protected void OnExport()
        {
            VersionControlItem  vcitem = GetItems()[0];
            MercurialRepository repo   = ((MercurialRepository)vcitem.Repository);

            FileChooserDialog fsd = new FileChooserDialog(GettextCatalog.GetString("Choose export location"),
                                                          null, FileChooserAction.Save, "Cancel", ResponseType.Cancel,
                                                          "Save", ResponseType.Accept);

            fsd.SetCurrentFolder(vcitem.Path.FullPath.ParentDirectory);

            try {
                if ((int)Gtk.ResponseType.Accept == fsd.Run() && !string.IsNullOrEmpty(fsd.Filename))
                {
                    MercurialTask worker = new MercurialTask();
                    worker.Description = string.Format("Exporting to {0}", fsd.Filename);
                    worker.Operation   = delegate { repo.Export(vcitem.Path, fsd.Filename, worker.ProgressMonitor); };
                    worker.Start();
                }
            } finally {
                fsd.Destroy();
            }
        }        // OnExport
Esempio n. 7
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