mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 04:34:59 +00:00
feature<Dashboard>: add menu to unset upstream and cancel tracking when deleting related remote branches
This commit is contained in:
parent
f041adb2b3
commit
584bac74f9
5 changed files with 37 additions and 7 deletions
|
@ -58,7 +58,7 @@ namespace SourceGit.Views.Widgets {
|
|||
|
||||
var watcher = Models.Watcher.Get(repo.Path);
|
||||
watcher.Navigate += NavigateTo;
|
||||
watcher.BranchChanged += UpdateBraches;
|
||||
watcher.BranchChanged += UpdateBranches;
|
||||
watcher.BranchChanged += UpdateCommits;
|
||||
watcher.WorkingCopyChanged += UpdateWorkingCopy;
|
||||
watcher.StashChanged += UpdateStashes;
|
||||
|
@ -94,7 +94,7 @@ namespace SourceGit.Views.Widgets {
|
|||
|
||||
#region DATA
|
||||
public void Refresh() {
|
||||
UpdateBraches();
|
||||
UpdateBranches();
|
||||
UpdateWorkingCopy();
|
||||
UpdateStashes();
|
||||
UpdateTags();
|
||||
|
@ -190,7 +190,7 @@ namespace SourceGit.Views.Widgets {
|
|||
foreach (var node in nodes) SortBranches(node.Children);
|
||||
}
|
||||
|
||||
private void UpdateBraches() {
|
||||
private void UpdateBranches() {
|
||||
if (!isFirstLoaded) return;
|
||||
|
||||
Task.Run(() => {
|
||||
|
@ -669,12 +669,22 @@ namespace SourceGit.Views.Widgets {
|
|||
if (branch.Upstream == b.FullName) target.Icon = currentTrackingIcon;
|
||||
target.Click += (o, e) => {
|
||||
new Commands.Branch(repo.Path, branch.Name).SetUpstream(upstream);
|
||||
UpdateBraches();
|
||||
UpdateBranches();
|
||||
e.Handled = true;
|
||||
};
|
||||
tracking.Items.Add(target);
|
||||
}
|
||||
|
||||
var unsetUpstream = new MenuItem();
|
||||
unsetUpstream.Header = App.Text("BranchCM.UnsetUpstream");
|
||||
unsetUpstream.Click += (_, e) => {
|
||||
new Commands.Branch(repo.Path, branch.Name).SetUpstream(string.Empty);
|
||||
UpdateBranches();
|
||||
e.Handled = true;
|
||||
};
|
||||
tracking.Items.Add(new Separator());
|
||||
tracking.Items.Add(unsetUpstream);
|
||||
|
||||
menu.Items.Add(tracking);
|
||||
}
|
||||
|
||||
|
@ -784,7 +794,12 @@ namespace SourceGit.Views.Widgets {
|
|||
var delete = new MenuItem();
|
||||
delete.Header = App.Text("BranchCM.Delete", branch.Name);
|
||||
delete.Click += (o, e) => {
|
||||
new Popups.DeleteBranch(repo.Path, branch.Name, branch.Remote).Show();
|
||||
new Popups.DeleteBranch(repo.Path, branch.Name, branch.Remote)
|
||||
.Then(() => {
|
||||
repo.Branches.FindAll(item => item.Upstream == branch.FullName).ForEach(item =>
|
||||
new Commands.Branch(repo.Path, item.Name).SetUpstream(string.Empty));
|
||||
})
|
||||
.Show();
|
||||
e.Handled = true;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue