Scenario: Local repo, before I leave the office
$ hg status
M important/update1
M another/important/update2
M work/in/progress
I want to commit and push important/update1 and important/update2, because I want to pull these files to my local repo when I get home. I'm not ready to commit work/in/progress. In fact it does not even parse correctly. That file is opened in my IDE and I just want to leave it as it is.
Now I do: (hurriedly, the tram leaves in three minutes)
$ hg commit important/update1 another/important/update2
$ hg push
pushing to https://**censored**
searching for changes
abort: push creates new remote heads on branch 'default'!
(did you forget to merge? use push -f to force)
Ok. Colleague has pushed something... (tram leaves in two minutes...)
$ hg pull (really important update!)
$ hg update
abort: outstanding uncommitted changes
Crap. I need colleagues' update but I'm not going to commit work/in/progress, much less push it! And I just missed my tram...
How do you deal with this?
If you don't want to use shelve, you can do it with just 3 commands:
hg diff > mylocalchanges.txt
hg revert -a
# Do your merge here, once you are done, import back your local mods
hg import --no-commit mylocalchanges.txt