Does sourcetree://openRepo (or similar) exist?
Asked by Raphael Summers:

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:

* sourcetree://cloneRepo/
  * Reference: Release 1.4 in <http://www.sourcetreeapp.com/update/ReleaseNotes.html>
* sourcetree://checkoutRef?...
  * Reference (the only one I found): [](https://gist.github.com/equinox79/7212950)<https://gist.github.com/equinox79/7212950>

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


Answers:
author: Raphael Summers
body: 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-2180)<https://jira.atlassian.com/browse/SRCTREE-2180>in order to request the feature.


author: Raphael Summers
body: 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.)<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 tellend 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 :)

comments: author: Seth
body: Cool. You might also file a feature request at [jira.atlassian.com](http://jira.atlassian.com).


author: Raphael Summers
body: Thank you for the suggestion! I have filed <https://jira.atlassian.com/browse/SRCTREE-2180>.


author: Seth
body: 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?

comments: author: Raphael Summers
body: 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.