mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-07 11:54:59 +00:00
feature: reset non-active branch to selected commit should not depends on upstream
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
188408fdfc
commit
7934496cff
1 changed files with 19 additions and 15 deletions
|
@ -1866,21 +1866,6 @@ namespace SourceGit.ViewModels
|
|||
};
|
||||
menu.Items.Add(fastForward);
|
||||
|
||||
var selectedCommit = (_histories?.DetailContext as CommitDetail)?.Commit;
|
||||
if (selectedCommit != null && !selectedCommit.SHA.Equals(branch.Head, StringComparison.Ordinal))
|
||||
{
|
||||
var move = new MenuItem();
|
||||
move.Header = App.Text("BranchCM.ResetToSelectedCommit", branch.Name, selectedCommit.SHA.Substring(0, 10));
|
||||
move.Icon = App.CreateMenuIcon("Icons.Reset");
|
||||
move.Click += (_, e) =>
|
||||
{
|
||||
if (CanCreatePopup())
|
||||
ShowPopup(new ResetWithoutCheckout(this, branch, selectedCommit));
|
||||
e.Handled = true;
|
||||
};
|
||||
menu.Items.Add(move);
|
||||
}
|
||||
|
||||
var fetchInto = new MenuItem();
|
||||
fetchInto.Header = App.Text("BranchCM.FetchInto", upstream.FriendlyName, branch.Name);
|
||||
fetchInto.Icon = App.CreateMenuIcon("Icons.Fetch");
|
||||
|
@ -1924,6 +1909,25 @@ namespace SourceGit.ViewModels
|
|||
menu.Items.Add(rebase);
|
||||
}
|
||||
|
||||
if (worktree == null)
|
||||
{
|
||||
var selectedCommit = (_histories?.DetailContext as CommitDetail)?.Commit;
|
||||
if (selectedCommit != null && !selectedCommit.SHA.Equals(branch.Head, StringComparison.Ordinal))
|
||||
{
|
||||
var move = new MenuItem();
|
||||
move.Header = App.Text("BranchCM.ResetToSelectedCommit", branch.Name, selectedCommit.SHA.Substring(0, 10));
|
||||
move.Icon = App.CreateMenuIcon("Icons.Reset");
|
||||
move.Click += (_, e) =>
|
||||
{
|
||||
if (CanCreatePopup())
|
||||
ShowPopup(new ResetWithoutCheckout(this, branch, selectedCommit));
|
||||
e.Handled = true;
|
||||
};
|
||||
menu.Items.Add(new MenuItem() { Header = "-" });
|
||||
menu.Items.Add(move);
|
||||
}
|
||||
}
|
||||
|
||||
var compareWithHead = new MenuItem();
|
||||
compareWithHead.Header = App.Text("BranchCM.CompareWithHead");
|
||||
compareWithHead.Icon = App.CreateMenuIcon("Icons.Compare");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue