Does sourcetree://openRepo (or similar) exist?

Why hello there!

I have an existing local git repository bookmarked in my version of SourceTree. Simply I wish to view it in SourceTree by use of a URL. Does the sourcetree URL scheme enable this?

I see that the following already is supported:

It also appears that 'openRepo' is supported by github-windows, github-mac and gittower URL schemes.

Unfortunately, I'm not able to find the SourceTree URL scheme anywhere online, and so I can't tell whether anything like openRepo, openBookmark or openWorkingCopy are supported (and testing various URLs has not been successful).

Any help would be hugely appreciated.

Regards,

Raphael

3 answers

1 accepted

I just received the automated 'Open question reminder' from Atlassian Answers. Based upon my own fairly extensive research and testing, and also in part due to the lack of a definitive answer above, it seems that the sourcetree:// scheme does not support being able to open or view a repository without first cloning it.

At Seth Foss' suggestion last week, I created https://jira.atlassian.com/browse/SRCTREE-2180in order to request the feature.

Eventually I created my own custom URL scheme using an application wrapper that I created and called Stree.app. I can now run the following URL in order to view a local repo in SourceTree:

stree:///path/to/repo/

In brief, I based my code upon the useful information at http://drosophiliac.com/2012/09/creating-a-custom-url-scheme-via-applescript-and-python.html.

For those interested, I created the application in AppleScript Editor containing the following code:

on open location streeURL
	set oldDelims to AppleScript's text item delimiters
	set newDelims to {"stree://"}
	set AppleScript's text item delimiters to newDelims
	set repoPath to item 2 of the text items of streeURL
	set AppleScript's text item delimiters to oldDelims
	
	tell application "SourceTree"
		open repoPath
		activate
	end tell
end open location

And then, in the Info.plist contained within the "Contents" directory of the application's package contents (right-click on the app to "Show Package Contents"), I added the following just above the final closing </dict> tag.

&lt;key&gt;CFBundleIdentifier&lt;/key&gt;
&lt;string&gt;com.AppleScript.Stree&lt;/string&gt;
&lt;key&gt;CFBundleURLTypes&lt;/key&gt;
&lt;array&gt;
        &lt;dict&gt;
                &lt;key&gt;CFBundleURLName&lt;/key&gt;
                &lt;string&gt;Stree&lt;/string&gt;
                &lt;key&gt;CFBundleURLSchemes&lt;/key&gt;
                &lt;array&gt;
                        &lt;string&gt;stree&lt;/string&gt;
                &lt;/array&gt;
        &lt;/dict&gt;
&lt;/array&gt;

I can't vouch that it is 100% correct, but it is certainly correct enough :)

Cool. You might also file a feature request at jira.atlassian.com.

I don't think SourceTree is able to view any repositories that aren't local (or at least present on locally-mounted storage). If a repository is local, why would you need a URL to view it?

Thank you for your response, Seth. I am using a project management tool and I wish to incorporate a SourceTree URL into my project such that one click will open SourceTree at the associated repository.

I would be surprised if the URL scheme accomodates cloning / checking-out but not viewing, given that viewing is a much simpler operation.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 30, 2018 in Sourcetree

Tip from the team: configuring Git or Mercurial in Sourcetree

Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...

420 views 0 1
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you