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

Raphael Summers March 27, 2014

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

0 votes
Answer accepted
Raphael Summers April 2, 2014

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.

1 vote
Raphael Summers March 27, 2014

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 :)

Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 27, 2014

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

Raphael Summers March 29, 2014

Thank you for the suggestion! I have filed https://jira.atlassian.com/browse/SRCTREE-2180.

0 votes
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 27, 2014

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?

Raphael Summers March 27, 2014

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
TAGS
AUG Leaders

Atlassian Community Events