From 9a68d70b29c76647f0935082eef2574b96f701fd Mon Sep 17 00:00:00 2001 From: leo Date: Sat, 24 Aug 2024 12:06:38 +0800 Subject: [PATCH] feature: add a button in file histories view to reset selected file to selected commit --- src/ViewModels/FileHistories.cs | 5 +++++ src/Views/FileHistories.axaml | 17 ++++++++++++++++- src/Views/FileHistories.axaml.cs | 18 ++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/ViewModels/FileHistories.cs b/src/ViewModels/FileHistories.cs index 68c5a7a1..5afd4302 100644 --- a/src/ViewModels/FileHistories.cs +++ b/src/ViewModels/FileHistories.cs @@ -79,6 +79,11 @@ namespace SourceGit.ViewModels _repo.NavigateToCommit(commit.SHA); } + public void ResetToSelectedRevision() + { + new Commands.Checkout(_repo.FullPath).FileWithRevision(_file, $"{_selectedCommit.SHA}"); + } + private void RefreshViewContent() { if (_selectedCommit == null) diff --git a/src/Views/FileHistories.axaml b/src/Views/FileHistories.axaml index 6c26fbd3..a00737fb 100644 --- a/src/Views/FileHistories.axaml +++ b/src/Views/FileHistories.axaml @@ -111,7 +111,7 @@ HorizontalAlignment="Center" VerticalAlignment="Center" IsVisible="{Binding IsLoading}"/> - + + +