diff --git a/RepoZ.Api.Win/Git/WindowsRepositoryActionProvider.cs b/RepoZ.Api.Win/Git/WindowsRepositoryActionProvider.cs index b22101e4..e21c2651 100644 --- a/RepoZ.Api.Win/Git/WindowsRepositoryActionProvider.cs +++ b/RepoZ.Api.Win/Git/WindowsRepositoryActionProvider.cs @@ -18,6 +18,7 @@ public class WindowsRepositoryActionProvider : IRepositoryActionProvider private string _windowsTerminalLocation; private string _codeLocation; + private string _sourceTreeLocation; public WindowsRepositoryActionProvider( IRepositoryWriter repositoryWriter, @@ -65,6 +66,12 @@ private IEnumerable GetContextMenuActionsInternal(IEnumerable< yield return CreateFileActionSubMenu(singleRepository, _translationService.Translate("Open Visual Studio solutions"), "*.sln"); + var sourceTreeExecutable = TryFindSourceTree(); + var hasSourceTree = !string.IsNullOrEmpty(sourceTreeExecutable); + if (hasSourceTree) + yield return CreateProcessRunnerAction(_translationService.Translate("Open in Sourcetree"), sourceTreeExecutable, "-f " + '"' + singleRepository.SafePath + '"'); + + yield return CreateBrowseRemoteAction(singleRepository); } @@ -164,6 +171,19 @@ private string TryFindWindowsTerminal() return _windowsTerminalLocation; } + private string TryFindSourceTree() + { + if (_sourceTreeLocation == null) + { + var folder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); + var executable = Path.Combine(folder, "SourceTree", "SourceTree.exe"); + + _sourceTreeLocation = File.Exists(executable) ? executable : string.Empty; + } + + return _sourceTreeLocation; + } + private string TryFindCode() { if (_codeLocation == null) diff --git a/RepoZ.App.Win/i18n/de-DE.xaml b/RepoZ.App.Win/i18n/de-DE.xaml index d2d2f6eb..8eeb2f6a 100644 --- a/RepoZ.App.Win/i18n/de-DE.xaml +++ b/RepoZ.App.Win/i18n/de-DE.xaml @@ -1,4 +1,4 @@ - @@ -38,6 +38,7 @@ Alternativ, kann der Computer auch über das Menü oben rechts nach Repositories In Git Bash öffnen In Finder öffnen Im Terminal öffnen + In Sourcetree öffnen {0} öffnen Remote-Repository öffnen Git Fetch diff --git a/RepoZ.App.Win/i18n/en-us.xaml b/RepoZ.App.Win/i18n/en-us.xaml index 3a864470..e5db3a00 100644 --- a/RepoZ.App.Win/i18n/en-us.xaml +++ b/RepoZ.App.Win/i18n/en-us.xaml @@ -39,6 +39,7 @@ Alternatively, you can scan your computer manually for repositories in the setti Open in Git Bash Open in Finder Open in Terminal + Open in Sourcetree Open {0} Browse remote repository Fetch diff --git a/RepoZ.App.Win/i18n/zh-cn.xaml b/RepoZ.App.Win/i18n/zh-cn.xaml index b9d48d33..678869bd 100644 --- a/RepoZ.App.Win/i18n/zh-cn.xaml +++ b/RepoZ.App.Win/i18n/zh-cn.xaml @@ -38,6 +38,7 @@ 在 Git Bash 中打开 在 Finder 中打开 在 Terminal 中打开 + Open in Sourcetree 打开 {0} Browse remote repository 获取