hg shelve: option --git not recognized
Asked by incidentist:

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 asideoptions: -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 timesuse "hg help shelve" to show the full help texthg shelve: option --git not recognizedCompleted with errors, see above
```


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

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


author: stevestreeting
body: 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>


author: stevestreeting
body: 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.


author: Pawel Krakowiak
body: I have the same problem with SourceTree 1.5.3. The only Mercurial installation that I had was the one from [MacHg](http://jasonfharris.com/machg/) app, but I removed MacHg from my system along with its application data folder. SourceTree still throws that error.

comments: author: Pawel Krakowiak
body: 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.


author: Pawel Krakowiak
body: 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.