Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions RepoZ.Api.Win/Git/WindowsRepositoryActionProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class WindowsRepositoryActionProvider : IRepositoryActionProvider

private string _windowsTerminalLocation;
private string _codeLocation;
private string _sourceTreeLocation;

public WindowsRepositoryActionProvider(
IRepositoryWriter repositoryWriter,
Expand Down Expand Up @@ -65,6 +66,12 @@ private IEnumerable<RepositoryAction> 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);
}

Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion RepoZ.App.Win/i18n/de-DE.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:RepoZ.App.Win.i18n"
xmlns:system="clr-namespace:System;assembly=mscorlib">
Expand Down Expand Up @@ -38,6 +38,7 @@ Alternativ, kann der Computer auch über das Menü oben rechts nach Repositories
<system:String x:Key="Open in Git Bash">In Git Bash öffnen</system:String>
<system:String x:Key="Open in Finder">In Finder öffnen</system:String>
<system:String x:Key="Open in Terminal">Im Terminal öffnen</system:String>
<system:String x:Key="Open in Sourcetree">In Sourcetree öffnen</system:String>
<system:String x:Key="Open {0}">{0} öffnen</system:String>
<system:String x:Key="Browse remote">Remote-Repository öffnen</system:String>
<system:String x:Key="Fetch">Git Fetch</system:String>
Expand Down
1 change: 1 addition & 0 deletions RepoZ.App.Win/i18n/en-us.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Alternatively, you can scan your computer manually for repositories in the setti
<system:String x:Key="Open in Git Bash">Open in Git Bash</system:String>
<system:String x:Key="Open in Finder">Open in Finder</system:String>
<system:String x:Key="Open in Terminal">Open in Terminal</system:String>
<system:String x:Key="Open in Sourcetree">Open in Sourcetree</system:String>
<system:String x:Key="Open {0}">Open {0}</system:String>
<system:String x:Key="Browse remote">Browse remote repository</system:String>
<system:String x:Key="Fetch">Fetch</system:String>
Expand Down
1 change: 1 addition & 0 deletions RepoZ.App.Win/i18n/zh-cn.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<system:String x:Key="Open in Git Bash">在 Git Bash 中打开</system:String>
<system:String x:Key="Open in Finder">在 Finder 中打开</system:String>
<system:String x:Key="Open in Terminal">在 Terminal 中打开</system:String>
<system:String x:Key="Open in Sourcetree">Open in Sourcetree</system:String>
<system:String x:Key="Open {0}">打开 {0}</system:String>
<system:String x:Key="Browse remote">Browse remote repository</system:String>
<system:String x:Key="Fetch">获取</system:String>
Expand Down