hg shelve: option --git not recognized

This is running SourceTree 1.3.2 with packaged Mercurial 2.0.1.

Steps to reproduce:

1. Make some changes in a repo

2. Click "Shelve" in SourceTree and enter a shelf name. Click OK.

What should happen: Changes should be shelved.

What happens: the following error appears:

hg shelve -y --git --force myShelfName 
hg shelve [OPTION]... [FILE]...

interactively select changes to set aside

options:

 -A --addremove           mark new/missing files as added/removed before
                          shelving
 -f --force               overwrite existing shelve data
 -a --append              append to existing shelve data
    --all                 shelve all changes
 -n --name VALUE          shelve changes to specified shelf name
 -l --list                list active shelves
 -I --include PATTERN [+] include names matching the given patterns
 -X --exclude PATTERN [+] exclude names matching the given patterns

[+] marked option can be specified multiple times

use "hg help shelve" to show the full help text
hg shelve: option --git not recognized
Completed with errors, see above

2 answers

1 accepted

I can't reproduce this. Please see this video: http://screencast.com/t/Fi8WUVqqLjD Note that in this case I have the 'Show full console output' option checked in Preferences so that you can see the command line even though it succeeds.

This is with the stock 1.3.2, embedded Mercurial, embedded Shelve extension. Have you enabled any other extensions in Preferences > Mercurial?

It's some sort of conflict with my system mercurial. I've used mercurial for a year, and had the shelve extension installed. When I remove the shelve extension line from my .hgrc, shelving works in SourceTree.

I still think this is a bug. When the shelve line is uncommented, the shelve extension appears in the Extensions list in SourceTree preferences. The box next to it is unchecked, meaning it is disabled, so I'm not sure why it's using my system shelve extension rather than the SourceTree shelve extension.

Yes, not overriding your system extension is a bug. Logged here: https://jira.atlassian.com/browse/SRCTREE-913

SourceTree actually uses the 'hgattic' extension, not the 'hgshelve' extension, because it's more flexible. I updated this myself to the latest hg, you can get it here if you like https://bitbucket.org/sinbad/hgattic/overview

Having investigated this, I could only re-create it if I added the hgshelve extension to my ~/.hgrc while SourceTree was running. Once SourceTree was restarted, it correctly detected the new hgshelve extension and disabled it in the environment that SourceTree runs hg in.

So I think this must have just been a temporary problem - SourceTree checks for custom extensions and disables them (unless you choose to re-enable them) but only at startup. You could probably force it to refresh by changing the enabled custom extension list in Preferences, but you would need to close and re-open the dialog in between changes to make them take effect.

I have the same problem with SourceTree 1.5.3. The only Mercurial installation that I had was the one from MacHg app, but I removed MacHg from my system along with its application data folder. SourceTree still throws that error.

Just installed version 1.5.5.1 (I didn't know there was something newer than 1.5.3) and it didn't help. I don't even have Mercurial installed in my system.

Got it working! I knew I installed manually the hgshelve extension some time before, I tracked it by going to *local working copy* settings (rather than app preferences) and opening the config file from there and I had this:

[extensions]
hgshelve=/Users/pawel/Tools/hgshelve.py

After removing those lines the shelve function in SourceTree started to work. Whew.

Suggest an answer

Log in or Join to answer
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

238 views 0 3
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot