mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2025-01-23 01:36:57 -08:00
feature: asking to create local branch instead of checkout commit if some remote branch's HEAD is selected commit (#295)
This commit is contained in:
parent
57e9c44754
commit
7891b1124e
1 changed files with 11 additions and 1 deletions
|
@ -147,6 +147,7 @@ namespace SourceGit.ViewModels
|
||||||
if (commit == null || commit.IsCurrentHead)
|
if (commit == null || commit.IsCurrentHead)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
var firstRemoteBranch = null as Models.Branch;
|
||||||
foreach (var d in commit.Decorators)
|
foreach (var d in commit.Decorators)
|
||||||
{
|
{
|
||||||
if (d.Type == Models.DecoratorType.LocalBranchHead)
|
if (d.Type == Models.DecoratorType.LocalBranchHead)
|
||||||
|
@ -158,11 +159,20 @@ namespace SourceGit.ViewModels
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (d.Type == Models.DecoratorType.RemoteBranchHead && firstRemoteBranch == null)
|
||||||
|
{
|
||||||
|
firstRemoteBranch = _repo.Branches.Find(x => x.FriendlyName == d.Name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PopupHost.CanCreatePopup())
|
if (PopupHost.CanCreatePopup())
|
||||||
|
{
|
||||||
|
if (firstRemoteBranch != null)
|
||||||
|
PopupHost.ShowPopup(new CreateBranch(_repo, firstRemoteBranch));
|
||||||
|
else
|
||||||
PopupHost.ShowPopup(new CheckoutCommit(_repo, commit));
|
PopupHost.ShowPopup(new CheckoutCommit(_repo, commit));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ContextMenu MakeContextMenu(DataGrid datagrid)
|
public ContextMenu MakeContextMenu(DataGrid datagrid)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue