protected void OnBind()
        {
            VersionControlItem vcitem      = GetItems()[0];
            BazaarRepository   repo        = (BazaarRepository)vcitem.Repository;
            string             boundBranch = repo.GetBoundBranch(vcitem.Path);

            var bsd = new BranchSelectionDialog(new string[] { boundBranch }, boundBranch, vcitem.Path.FullPath, false, false, false, false);

            try
            {
                if ((int)Gtk.ResponseType.Ok == bsd.Run() && !string.IsNullOrEmpty(bsd.SelectedLocation))
                {
                    BazaarTask worker = new BazaarTask();
                    worker.Description = string.Format("Binding to {0}", bsd.SelectedLocation);
                    worker.Operation   = delegate
                    {
                        repo.Bind(bsd.SelectedLocation, vcitem.Path, worker.ProgressMonitor);
                    };
                    worker.Start();
                }
            }
            finally
            {
                bsd.Destroy();
            }
        }
        protected override void Run()
        {
            var bsd = new 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);
                    BazaarTask worker     = new BazaarTask();
                    worker.Description = string.Format("Branching from {0} to {1}", branchLocation, localPath);
                    worker.Operation   = delegate
                    {
                        DoBranch(branchLocation, localPath, worker.ProgressMonitor);
                    };
                    worker.Start();
                }
            }
            finally
            {
                bsd.Destroy();
            }
        }
        protected void OnBzrPublish()
        {
            VersionControlItem vcitem = GetItems()[0];
            BazaarRepository   repo   = ((BazaarRepository)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(BazaarRepository.GetLocalBasePath(vcitem.Path.FullPath)))
            {
                MessageDialog md = new MessageDialog(null, 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

            var bsd = new BranchSelectionDialog(branches.Keys, defaultBranch, localPath, false, true, true, true);

            try
            {
                if ((int)Gtk.ResponseType.Ok == bsd.Run() && !string.IsNullOrEmpty(bsd.SelectedLocation))
                {
                    BazaarTask worker = new BazaarTask();
                    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();
            }
        }
        protected void OnPull()
        {
            VersionControlItem vcitem = GetItems()[0];
            BazaarRepository   repo   = ((BazaarRepository)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

            var bsd = new BranchSelectionDialog(branches.Keys, defaultBranch, localPath, false, true, true, false);

            try
            {
                if ((int)Gtk.ResponseType.Ok == bsd.Run() && !string.IsNullOrEmpty(bsd.SelectedLocation))
                {
                    BazaarTask worker = new BazaarTask();
                    worker.Description = string.Format("Pulling from {0}", bsd.SelectedLocation);
                    worker.Operation   = delegate
                    {
                        repo.Pull(bsd.SelectedLocation, vcitem.Path, bsd.SaveDefault, bsd.Overwrite, worker.ProgressMonitor);
                    };
                    worker.Start();
                }
            }
            finally
            {
                bsd.Destroy();
            }
        }
 protected override void Run()
 {
     var bsd = new 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);
             BazaarTask worker = new BazaarTask();
             worker.Description = string.Format("Branching from {0} to {1}", branchLocation, localPath);
             worker.Operation = delegate
             {
                 DoBranch(branchLocation, localPath, worker.ProgressMonitor);
             };
             worker.Start();
         }
     }
     finally
     {
         bsd.Destroy();
     }
 }
        protected void OnPull()
        {
            VersionControlItem vcitem = GetItems()[0];
            BazaarRepository repo = ((BazaarRepository)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

            var bsd = new BranchSelectionDialog(branches.Keys, defaultBranch, localPath, false, true, true, false);
            try
            {
                if ((int)Gtk.ResponseType.Ok == bsd.Run() && !string.IsNullOrEmpty(bsd.SelectedLocation))
                {
                    BazaarTask worker = new BazaarTask();
                    worker.Description = string.Format("Pulling from {0}", bsd.SelectedLocation);
                    worker.Operation = delegate
                    {
                        repo.Pull(bsd.SelectedLocation, vcitem.Path, bsd.SaveDefault, bsd.Overwrite, worker.ProgressMonitor);
                    };
                    worker.Start();
                }
            }
            finally
            {
                bsd.Destroy();
            }
        }
        protected void OnMerge()
        {
            VersionControlItem vcitem = GetItems()[0];
            BazaarRepository repo = ((BazaarRepository)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(BazaarRepository.GetLocalBasePath(vcitem.Path.FullPath)))
            {
                var md = new MessageDialog(null, DialogFlags.Modal,
                             MessageType.Question, ButtonsType.YesNo,
                             GettextCatalog.GetString("You have uncommitted local changes. Merge 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

            var bsd = new BranchSelectionDialog(branches.Keys, defaultBranch, localPath, false, true, false, false);
            try
            {
                if ((int)Gtk.ResponseType.Ok == bsd.Run() && !string.IsNullOrEmpty(bsd.SelectedLocation))
                {
                    BazaarTask worker = new BazaarTask();
                    worker.Description = string.Format("Merging from {0}", bsd.SelectedLocation);
                    worker.Operation = delegate
                    {
                        repo.Merge(bsd.SelectedLocation, vcitem.Path, bsd.SaveDefault, true, worker.ProgressMonitor);
                    };
                    worker.Start();
                }
            }
            finally
            {
                bsd.Destroy();
            }
        }
        protected void OnBind()
        {
            VersionControlItem vcitem = GetItems()[0];
            BazaarRepository repo = (BazaarRepository)vcitem.Repository;
            string boundBranch = repo.GetBoundBranch(vcitem.Path);

            var bsd = new BranchSelectionDialog(new string[]{ boundBranch }, boundBranch, vcitem.Path.FullPath, false, false, false, false);
            try
            {
                if ((int)Gtk.ResponseType.Ok == bsd.Run() && !string.IsNullOrEmpty(bsd.SelectedLocation))
                {
                    BazaarTask worker = new BazaarTask();
                    worker.Description = string.Format("Binding to {0}", bsd.SelectedLocation);
                    worker.Operation = delegate
                    {
                        repo.Bind(bsd.SelectedLocation, vcitem.Path, worker.ProgressMonitor);
                    };
                    worker.Start();
                }
            }
            finally
            {
                bsd.Destroy();
            }
        }