How can I configure a SourceTree custom action to perform hg flow feature promote?

blurkk May 1, 2016

SourceTree supports the notion of custom actions, though they only appear to run external scripts rather than provide a mechanism to run custom embedded Mercurial and Git commands not already present in the UI. SourceTree also supports the hgflow extension for Mercurial, but only presents a UI for a limited subset of the workflow commands.

Specifically, I would like to promote the current set of commits in a feature branch into the development branch, without closing the feature branch. A hg flow feature promote command would appear to what I need, but I need some instructions about how to configure that as a SourceTree custom action. It would be easy to script that if I could run the command on a command line, but I don't know how to run SourceTree's embedded Mercurial command with the embedded hgflow extension enabled. I tried running /Applications/SourceTree.app/Contents/Resources/mercurial_local/hg_local flow but I get the following error:

 

hg: unknown command 'flow'
'flow' is provided by the following extension:
 
    hgflow        commands to support Driessen's branching model
 
(use "hg help extensions" for information on enabling extensions)

 

I could download the hgflow extension for the system copy of Mercurial, but I'm a bit wary about mixing between the embedded SourceTree Mercurial and system Mercurial.

So, does anyone know how to get a SourceTree custom action to make use of a command using the embedded Mercurial with its embedded extensions enabled?

Alternatively, would there be any risks in configuring my system Mercurial to use extensions supplied with the SourceTree embedded Mercurial?

1 answer

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.
May 2, 2016

For all local repository operations, SourceTree is simply a GUI wrapper around the git command line interface.

So, if you install hg flow onto your system Mercurial, you shouldn't have any problems as long as the command syntax is the same for the commands SourceTree runs. I recommend trying it. If the command syntax is different, you're most likely going to get error messages when trying to perform hg flow commands, with no harm to your repo. Any commands that don't involve hg flow should operate normally. If you don't use the SourceTree built-in hg flow buttons, and just use custom actions, you should be in great shape regardless.

blurkk May 3, 2016

For all local repository operations, SourceTree is simply a GUI wrapper around the git command line interface.

Sure, but it's a wrapper around the embedded copy of the mercurial command line, which can be, and in my case is, at a different version to the system mercurial. Hence my caution. So, in essence I would like my scripts that I want to attach to custom actions to run the embedded mercurial command line (I have found a hg_local binary within the SourceTree bundle). But running hg_local directly from the command line doesn't seem to have the hgflow extension enabled.

If you don't use the SourceTree built-in hg flow buttons

Aaah, but I want to keep using the built-in buttons. I want to extend, not replace.

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.
May 4, 2016

I guess I'm not entirely clear about what final setup you're hoping for - it sounds overly complex to me. I would recommend you choose one of the following solutions:

  1. Configure SourceTree to use Embedded Mercurial. Install whatever hgflow includes "promote" into the embedded mercurial (this step may need to be repeated if you allow SourceTree to update the embedded hg)
  2. Configure SourceTree to use System Mercurial. Install whatever hgflow includes "promote" into the system mercurial.

Either way, the only factor in whether or not this will work is whether the command line syntax for whatever version of hgflow you install is backwards-compatible with the version SourceTree expects. Chances are it will be compatible, and even if it's not, I think testing is low-risk (in other words, if it does break, the only thing it should break are the flow features).

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events