mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 20:24:59 +00:00
feature: add a context menu item to compare selected branch/revision with current worktree
This commit is contained in:
parent
211e4b24c1
commit
52ef0db427
6 changed files with 119 additions and 30 deletions
|
@ -318,10 +318,10 @@ namespace SourceGit.ViewModels
|
|||
|
||||
if (current.Head != commit.SHA)
|
||||
{
|
||||
var compare = new MenuItem();
|
||||
compare.Header = App.Text("CommitCM.CompareWithHead");
|
||||
compare.Icon = App.CreateMenuIcon("Icons.Compare");
|
||||
compare.Click += (o, e) =>
|
||||
var compareWithHead = new MenuItem();
|
||||
compareWithHead.Header = App.Text("CommitCM.CompareWithHead");
|
||||
compareWithHead.Icon = App.CreateMenuIcon("Icons.Compare");
|
||||
compareWithHead.Click += (o, e) =>
|
||||
{
|
||||
var head = _commits.Find(x => x.SHA == current.Head);
|
||||
if (head == null)
|
||||
|
@ -338,8 +338,21 @@ namespace SourceGit.ViewModels
|
|||
|
||||
e.Handled = true;
|
||||
};
|
||||
menu.Items.Add(compareWithHead);
|
||||
|
||||
if (_repo.WorkingCopyChangesCount > 0)
|
||||
{
|
||||
var compareWithWorktree = new MenuItem();
|
||||
compareWithWorktree.Header = App.Text("CommitCM.CompareWithWorktree");
|
||||
compareWithWorktree.Icon = App.CreateMenuIcon("Icons.Compare");
|
||||
compareWithWorktree.Click += (o, e) =>
|
||||
{
|
||||
DetailContext = new RevisionCompare(_repo.FullPath, commit, null);
|
||||
e.Handled = true;
|
||||
};
|
||||
menu.Items.Add(compareWithWorktree);
|
||||
}
|
||||
|
||||
menu.Items.Add(compare);
|
||||
menu.Items.Add(new MenuItem() { Header = "-" });
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue