16

Our team is just getting started with Mercurial. One of the first things we've started to play with is hg shelve. Locally, I have no problem shelving changes. It all works perfectly from what I can tell. However, when I try to unshelve, I get the restoring backup files message, but when I run hg diff, there are no changes, and my changes are missing from the code. If i do hg unshelve -i I can see the diff, but again, trying to unshelve seems to have no effect.

I've been trying to test it with some very simple changes that shouldn't be a problem in terms of conflicts, e.g. adding a test comment. I should note that I've tried hg unshelve -f after which it says unshelve completed but again, my changes are not restored.

Any ideas what I am doing wrong?

If it matters: Mercurial Distributed SCM (version 1.5.1+20100405)

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
shanebonham
  • 2,219
  • 2
  • 18
  • 19
  • 1
    Just found this: https://bitbucket.org/tksoh/hgshelve/issue/11/unshelve-is-not-restoring-file-changes Soooo, hg unshelve is just broken? Does that seem right? – shanebonham May 06 '10 at 20:54
  • 2
    It's worth mentioning that `hg shelve` isn't a part of mercurial, it's someone else's third-party extension. I suspect one reason `shelve` isn't part of mercurial is that it doesn't really fit the mercurial mindset. The mercurial way to shelve is to either just commit and then update to one revision back or to quickly clone your repo. A clone is instantaneous, takes up almost no space (hardlinks on modern filesystems), and doesn't have your uncommitted changes. Even if your team end up using shelve you should start them off with vanilla mercurial so they learn the idiom. – Ry4an Brase May 06 '10 at 21:36
  • 5
    It's also worth mentioning that Bryan O' Sullivan is one of the authors of hgshelve and a core developer for Mercurial, so it's not just some random third-party extension. By all means learn the no-frills way first, but don't discourage people from using Mercurial however it's convenient for them. – Mu Mind Mar 07 '11 at 14:19
  • 4
    I used "hg shelve -i | patch -p1" as a workaround. – Nick Sep 21 '11 at 11:45
  • 1
    "hg unshelve -i | patch -p1" worked for me to recover, and I had to remove .hg/shelves so that "hg shelve -l" wouldn't list the shelve anymore. – jwhitlock Oct 17 '11 at 16:39

2 Answers2

8

Tried that fork and it works: https://bitbucket.org/astiob/hgshelve/

So the answer seems to be, yes, it is broken, and yes, that fork fixes it.

tecywiz121
  • 169
  • 1
  • 7
shanebonham
  • 2,219
  • 2
  • 18
  • 19
  • 1
    The "astiob" fork has been pulled into the "tksoh" mainline. I'm still having issues, using Mecurial 1.7.1. – jwhitlock Oct 17 '11 at 16:42
  • That fork also does not work for me, but @Nick's comment worked: `hg shelve -i | patch -p1` – Pascal Nov 30 '11 at 01:43
1

As an update, I am currently on version Mercurial Distributed SCM (version 2.9.1) and have no issues. If you are still experiencing problems with unshelve, I recommend updating to the newest Mercurial version.

stevebot
  • 23,275
  • 29
  • 119
  • 181