mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-23 10:22:13 +08:00
feature: double-clicking tag will try to checkout (detached mode) the revision refered by selected tag (#1661)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
@@ -1448,6 +1448,13 @@ namespace SourceGit.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public async Task CheckoutTagAsync(Models.Tag tag)
|
||||
{
|
||||
var c = await new Commands.QuerySingleCommit(_fullpath, tag.SHA).GetResultAsync();
|
||||
if (c != null)
|
||||
_histories?.CheckoutBranchByCommit(c);
|
||||
}
|
||||
|
||||
public async Task CompareBranchWithWorktree(Models.Branch branch)
|
||||
{
|
||||
if (_histories != null)
|
||||
|
||||
@@ -96,6 +96,7 @@
|
||||
<Border Height="24"
|
||||
Background="Transparent"
|
||||
PointerPressed="OnItemPointerPressed"
|
||||
DoubleTapped="OnItemDoubleTapped"
|
||||
ContextRequested="OnItemContextRequested"
|
||||
ToolTip.Placement="Right">
|
||||
<ToolTip.Tip>
|
||||
|
||||
@@ -155,10 +155,20 @@ namespace SourceGit.Views
|
||||
}
|
||||
}
|
||||
|
||||
private void OnItemDoubleTapped(object sender, TappedEventArgs e)
|
||||
private async void OnItemDoubleTapped(object sender, TappedEventArgs e)
|
||||
{
|
||||
if (sender is Control { DataContext: ViewModels.TagTreeNode { IsFolder: true } node })
|
||||
ToggleNodeIsExpanded(node);
|
||||
if (sender is Control { DataContext: ViewModels.TagTreeNode node })
|
||||
{
|
||||
if (node.IsFolder)
|
||||
ToggleNodeIsExpanded(node);
|
||||
else if (DataContext is ViewModels.Repository repo)
|
||||
await repo.CheckoutTagAsync(node.Tag);
|
||||
}
|
||||
else if (sender is Control { DataContext: Models.Tag tag })
|
||||
{
|
||||
if (DataContext is ViewModels.Repository repo)
|
||||
await repo.CheckoutTagAsync(tag);
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user