160
/// Determines whether a rebase can be performed.
162
[CommandUpdateHandler (MercurialCommands.Rebase)]
163
protected void CanRebase (CommandInfo item)
171
[CommandHandler (MercurialCommands.Rebase)]
172
protected void OnRebase()
174
VersionControlItem vcitem = GetItems ()[0];
175
MercurialRepository repo = ((MercurialRepository)vcitem.Repository);
176
Dictionary<string, BranchType> branches = repo.GetKnownBranches (vcitem.Path);
177
string defaultBranch = string.Empty,
178
localPath = vcitem.IsDirectory? (string)vcitem.Path.FullPath: Path.GetDirectoryName (vcitem.Path.FullPath);
180
foreach (KeyValuePair<string, BranchType> branch in branches) {
181
if (BranchType.Parent == branch.Value) {
182
defaultBranch = branch.Key;
185
}// check for parent branch
187
Dialogs.BranchSelectionDialog bsd = new Dialogs.BranchSelectionDialog (branches.Keys, defaultBranch, localPath, false, true, true, false);
189
if ((int)Gtk.ResponseType.Ok == bsd.Run () && !string.IsNullOrEmpty (bsd.SelectedLocation)) {
190
MercurialTask worker = new MercurialTask ();
191
worker.Description = string.Format ("Rebasing on {0}", bsd.SelectedLocation);
192
worker.Operation = delegate{ repo.Rebase (bsd.SelectedLocation, vcitem.Path, bsd.SaveDefault, bsd.Overwrite, worker.ProgressMonitor); };
159
201
/// Determines whether a merge can be performed.