mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-26 21:17:20 -08:00
feature: allows to copy branch/tag name from the context menu of selected commit
This commit is contained in:
parent
400aaacf18
commit
dfc03d7a8f
1 changed files with 74 additions and 34 deletions
|
@ -813,6 +813,8 @@ namespace SourceGit.ViewModels
|
||||||
submenu.Icon = App.CreateMenuIcon("Icons.Branch");
|
submenu.Icon = App.CreateMenuIcon("Icons.Branch");
|
||||||
submenu.Header = current.Name;
|
submenu.Header = current.Name;
|
||||||
|
|
||||||
|
FillBranchVisibilityMenu(submenu, current);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(current.Upstream))
|
if (!string.IsNullOrEmpty(current.Upstream))
|
||||||
{
|
{
|
||||||
var upstream = current.Upstream.Substring(13);
|
var upstream = current.Upstream.Substring(13);
|
||||||
|
@ -852,6 +854,17 @@ namespace SourceGit.ViewModels
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
submenu.Items.Add(push);
|
submenu.Items.Add(push);
|
||||||
|
|
||||||
|
var rename = new MenuItem();
|
||||||
|
rename.Header = new Views.NameHighlightedTextBlock("BranchCM.Rename", current.Name);
|
||||||
|
rename.Icon = App.CreateMenuIcon("Icons.Rename");
|
||||||
|
rename.Click += (_, e) =>
|
||||||
|
{
|
||||||
|
if (PopupHost.CanCreatePopup())
|
||||||
|
PopupHost.ShowPopup(new RenameBranch(_repo, current));
|
||||||
|
e.Handled = true;
|
||||||
|
};
|
||||||
|
submenu.Items.Add(rename);
|
||||||
submenu.Items.Add(new MenuItem() { Header = "-" });
|
submenu.Items.Add(new MenuItem() { Header = "-" });
|
||||||
|
|
||||||
var detect = Commands.GitFlow.DetectType(_repo.FullPath, _repo.Branches, current.Name);
|
var detect = Commands.GitFlow.DetectType(_repo.FullPath, _repo.Branches, current.Name);
|
||||||
|
@ -870,18 +883,15 @@ namespace SourceGit.ViewModels
|
||||||
submenu.Items.Add(new MenuItem() { Header = "-" });
|
submenu.Items.Add(new MenuItem() { Header = "-" });
|
||||||
}
|
}
|
||||||
|
|
||||||
FillBranchVisibilityMenu(submenu, current);
|
var copy = new MenuItem();
|
||||||
|
copy.Header = App.Text("BranchCM.CopyName");
|
||||||
var rename = new MenuItem();
|
copy.Icon = App.CreateMenuIcon("Icons.Copy");
|
||||||
rename.Header = new Views.NameHighlightedTextBlock("BranchCM.Rename", current.Name);
|
copy.Click += (_, e) =>
|
||||||
rename.Icon = App.CreateMenuIcon("Icons.Rename");
|
|
||||||
rename.Click += (_, e) =>
|
|
||||||
{
|
{
|
||||||
if (PopupHost.CanCreatePopup())
|
App.CopyText(current.Name);
|
||||||
PopupHost.ShowPopup(new RenameBranch(_repo, current));
|
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
submenu.Items.Add(rename);
|
submenu.Items.Add(copy);
|
||||||
|
|
||||||
menu.Items.Add(submenu);
|
menu.Items.Add(submenu);
|
||||||
}
|
}
|
||||||
|
@ -892,6 +902,8 @@ namespace SourceGit.ViewModels
|
||||||
submenu.Icon = App.CreateMenuIcon("Icons.Branch");
|
submenu.Icon = App.CreateMenuIcon("Icons.Branch");
|
||||||
submenu.Header = branch.Name;
|
submenu.Header = branch.Name;
|
||||||
|
|
||||||
|
FillBranchVisibilityMenu(submenu, branch);
|
||||||
|
|
||||||
var checkout = new MenuItem();
|
var checkout = new MenuItem();
|
||||||
checkout.Header = new Views.NameHighlightedTextBlock("BranchCM.Checkout", branch.Name);
|
checkout.Header = new Views.NameHighlightedTextBlock("BranchCM.Checkout", branch.Name);
|
||||||
checkout.Icon = App.CreateMenuIcon("Icons.Check");
|
checkout.Icon = App.CreateMenuIcon("Icons.Check");
|
||||||
|
@ -913,25 +925,6 @@ namespace SourceGit.ViewModels
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
submenu.Items.Add(merge);
|
submenu.Items.Add(merge);
|
||||||
submenu.Items.Add(new MenuItem() { Header = "-" });
|
|
||||||
|
|
||||||
var detect = Commands.GitFlow.DetectType(_repo.FullPath, _repo.Branches, branch.Name);
|
|
||||||
if (detect.IsGitFlowBranch)
|
|
||||||
{
|
|
||||||
var finish = new MenuItem();
|
|
||||||
finish.Header = new Views.NameHighlightedTextBlock("BranchCM.Finish", branch.Name);
|
|
||||||
finish.Icon = App.CreateMenuIcon("Icons.GitFlow");
|
|
||||||
finish.Click += (_, e) =>
|
|
||||||
{
|
|
||||||
if (PopupHost.CanCreatePopup())
|
|
||||||
PopupHost.ShowPopup(new GitFlowFinish(_repo, branch, detect.Type, detect.Prefix));
|
|
||||||
e.Handled = true;
|
|
||||||
};
|
|
||||||
submenu.Items.Add(finish);
|
|
||||||
submenu.Items.Add(new MenuItem() { Header = "-" });
|
|
||||||
}
|
|
||||||
|
|
||||||
FillBranchVisibilityMenu(submenu, branch);
|
|
||||||
|
|
||||||
var rename = new MenuItem();
|
var rename = new MenuItem();
|
||||||
rename.Header = new Views.NameHighlightedTextBlock("BranchCM.Rename", branch.Name);
|
rename.Header = new Views.NameHighlightedTextBlock("BranchCM.Rename", branch.Name);
|
||||||
|
@ -954,6 +947,33 @@ namespace SourceGit.ViewModels
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
submenu.Items.Add(delete);
|
submenu.Items.Add(delete);
|
||||||
|
submenu.Items.Add(new MenuItem() { Header = "-" });
|
||||||
|
|
||||||
|
var detect = Commands.GitFlow.DetectType(_repo.FullPath, _repo.Branches, branch.Name);
|
||||||
|
if (detect.IsGitFlowBranch)
|
||||||
|
{
|
||||||
|
var finish = new MenuItem();
|
||||||
|
finish.Header = new Views.NameHighlightedTextBlock("BranchCM.Finish", branch.Name);
|
||||||
|
finish.Icon = App.CreateMenuIcon("Icons.GitFlow");
|
||||||
|
finish.Click += (_, e) =>
|
||||||
|
{
|
||||||
|
if (PopupHost.CanCreatePopup())
|
||||||
|
PopupHost.ShowPopup(new GitFlowFinish(_repo, branch, detect.Type, detect.Prefix));
|
||||||
|
e.Handled = true;
|
||||||
|
};
|
||||||
|
submenu.Items.Add(finish);
|
||||||
|
submenu.Items.Add(new MenuItem() { Header = "-" });
|
||||||
|
}
|
||||||
|
|
||||||
|
var copy = new MenuItem();
|
||||||
|
copy.Header = App.Text("BranchCM.CopyName");
|
||||||
|
copy.Icon = App.CreateMenuIcon("Icons.Copy");
|
||||||
|
copy.Click += (_, e) =>
|
||||||
|
{
|
||||||
|
App.CopyText(branch.Name);
|
||||||
|
e.Handled = true;
|
||||||
|
};
|
||||||
|
submenu.Items.Add(copy);
|
||||||
|
|
||||||
menu.Items.Add(submenu);
|
menu.Items.Add(submenu);
|
||||||
}
|
}
|
||||||
|
@ -966,6 +986,8 @@ namespace SourceGit.ViewModels
|
||||||
submenu.Icon = App.CreateMenuIcon("Icons.Branch");
|
submenu.Icon = App.CreateMenuIcon("Icons.Branch");
|
||||||
submenu.Header = name;
|
submenu.Header = name;
|
||||||
|
|
||||||
|
FillBranchVisibilityMenu(submenu, branch);
|
||||||
|
|
||||||
var checkout = new MenuItem();
|
var checkout = new MenuItem();
|
||||||
checkout.Header = new Views.NameHighlightedTextBlock("BranchCM.Checkout", name);
|
checkout.Header = new Views.NameHighlightedTextBlock("BranchCM.Checkout", name);
|
||||||
checkout.Icon = App.CreateMenuIcon("Icons.Check");
|
checkout.Icon = App.CreateMenuIcon("Icons.Check");
|
||||||
|
@ -988,9 +1010,6 @@ namespace SourceGit.ViewModels
|
||||||
};
|
};
|
||||||
|
|
||||||
submenu.Items.Add(merge);
|
submenu.Items.Add(merge);
|
||||||
submenu.Items.Add(new MenuItem() { Header = "-" });
|
|
||||||
|
|
||||||
FillBranchVisibilityMenu(submenu, branch);
|
|
||||||
|
|
||||||
var delete = new MenuItem();
|
var delete = new MenuItem();
|
||||||
delete.Header = new Views.NameHighlightedTextBlock("BranchCM.Delete", name);
|
delete.Header = new Views.NameHighlightedTextBlock("BranchCM.Delete", name);
|
||||||
|
@ -1002,6 +1021,17 @@ namespace SourceGit.ViewModels
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
submenu.Items.Add(delete);
|
submenu.Items.Add(delete);
|
||||||
|
submenu.Items.Add(new MenuItem() { Header = "-" });
|
||||||
|
|
||||||
|
var copy = new MenuItem();
|
||||||
|
copy.Header = App.Text("BranchCM.CopyName");
|
||||||
|
copy.Icon = App.CreateMenuIcon("Icons.Copy");
|
||||||
|
copy.Click += (_, e) =>
|
||||||
|
{
|
||||||
|
App.CopyText(name);
|
||||||
|
e.Handled = true;
|
||||||
|
};
|
||||||
|
submenu.Items.Add(copy);
|
||||||
|
|
||||||
menu.Items.Add(submenu);
|
menu.Items.Add(submenu);
|
||||||
}
|
}
|
||||||
|
@ -1013,6 +1043,8 @@ namespace SourceGit.ViewModels
|
||||||
submenu.Icon = App.CreateMenuIcon("Icons.Tag");
|
submenu.Icon = App.CreateMenuIcon("Icons.Tag");
|
||||||
submenu.MinWidth = 200;
|
submenu.MinWidth = 200;
|
||||||
|
|
||||||
|
FillTagVisibilityMenu(submenu, tag);
|
||||||
|
|
||||||
var push = new MenuItem();
|
var push = new MenuItem();
|
||||||
push.Header = new Views.NameHighlightedTextBlock("TagCM.Push", tag.Name);
|
push.Header = new Views.NameHighlightedTextBlock("TagCM.Push", tag.Name);
|
||||||
push.Icon = App.CreateMenuIcon("Icons.Push");
|
push.Icon = App.CreateMenuIcon("Icons.Push");
|
||||||
|
@ -1036,9 +1068,6 @@ namespace SourceGit.ViewModels
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
submenu.Items.Add(merge);
|
submenu.Items.Add(merge);
|
||||||
submenu.Items.Add(new MenuItem() { Header = "-" });
|
|
||||||
|
|
||||||
FillTagVisibilityMenu(submenu, tag);
|
|
||||||
|
|
||||||
var delete = new MenuItem();
|
var delete = new MenuItem();
|
||||||
delete.Header = new Views.NameHighlightedTextBlock("TagCM.Delete", tag.Name);
|
delete.Header = new Views.NameHighlightedTextBlock("TagCM.Delete", tag.Name);
|
||||||
|
@ -1050,6 +1079,17 @@ namespace SourceGit.ViewModels
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
};
|
};
|
||||||
submenu.Items.Add(delete);
|
submenu.Items.Add(delete);
|
||||||
|
submenu.Items.Add(new MenuItem() { Header = "-" });
|
||||||
|
|
||||||
|
var copy = new MenuItem();
|
||||||
|
copy.Header = App.Text("TagCM.Copy");
|
||||||
|
copy.Icon = App.CreateMenuIcon("Icons.Copy");
|
||||||
|
copy.Click += (_, e) =>
|
||||||
|
{
|
||||||
|
App.CopyText(tag.Name);
|
||||||
|
e.Handled = true;
|
||||||
|
};
|
||||||
|
submenu.Items.Add(copy);
|
||||||
|
|
||||||
menu.Items.Add(submenu);
|
menu.Items.Add(submenu);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue