version-controlmercurialunshelve

Is there a way to get a mercurial shelf back after a merge mistake?


When I unshelve, it uses mercurial's merge capability, but I'm not seeing any way to get back the original shelved patch and redo things if I've completed the merge with an error. Aside from searching backup drives, is there any way to do that? (either to undo the unshelve action and put the shelf back, or to see what was in the patch file)


Solution

  • I found it — by looking around in the .hg directory. Simply find the directory .hg/shelve-backup/. The original patch is written there.

    I now see this is mentioned in hg help unshelve though I had missed it before now (and it does not say the name of the directory)

    After a successful unshelve, the shelved changes are stored in a backup
    directory. Only the N most recent backups are kept. N defaults to 10 but
    can be overridden using the "shelve.maxbackups" configuration option.