feature(WorkingCopy): add context menu entry to view histories from selected unstaged change

This commit is contained in:
leo 2020-08-07 17:16:17 +08:00
parent 5fa2c601a8
commit e00799555f
2 changed files with 22 additions and 1 deletions

View file

@ -474,7 +474,6 @@ namespace SourceGit.Git {
}, true); }, true);
OnSubmoduleChanged?.Invoke(); OnSubmoduleChanged?.Invoke();
AssertCommand(errs); AssertCommand(errs);
} }

View file

@ -282,6 +282,17 @@ namespace SourceGit.UI {
menu.Items.Add(stash); menu.Items.Add(stash);
menu.Items.Add(patch); menu.Items.Add(patch);
menu.Items.Add(new Separator()); menu.Items.Add(new Separator());
if (node.Change != null) {
var history = new MenuItem();
history.Header = "Histories ...";
history.Click += (o, e) => {
var viewer = new FileHistories(Repo, node.FilePath);
viewer.Show();
e.Handled = true;
};
menu.Items.Add(history);
menu.Items.Add(new Separator());
}
menu.Items.Add(copyPath); menu.Items.Add(copyPath);
menu.IsOpen = true; menu.IsOpen = true;
} else if (selected.Count > 1) { } else if (selected.Count > 1) {
@ -413,6 +424,17 @@ namespace SourceGit.UI {
menu.Items.Add(stash); menu.Items.Add(stash);
menu.Items.Add(patch); menu.Items.Add(patch);
menu.Items.Add(new Separator()); menu.Items.Add(new Separator());
if (change != null) {
var history = new MenuItem();
history.Header = "Histories ...";
history.Click += (o, e) => {
var viewer = new FileHistories(Repo, change.Path);
viewer.Show();
e.Handled = true;
};
menu.Items.Add(history);
menu.Items.Add(new Separator());
}
menu.Items.Add(copyPath); menu.Items.Add(copyPath);
menu.IsOpen = true; menu.IsOpen = true;
} else if (selected.Count > 1) { } else if (selected.Count > 1) {