1. Oleg Oshmyan
  2. hgshelve
  3. Issues
Issue #16 open

Discarding the shelve

Lorenzo Petrone
created an issue

What if I just want to discard what I shelved before, instead of unshelving it?

I can't find anything about that, neither in the help nor in the mercurial wiki...

Comments (5)

  1. TK Soh
    • changed status to open

    You are right. There is no such option. It's kind of dangerous to do so, since you can lose your shelved data permanently by accident. If you really want to, you can just delete the content of <repo>/.hg/shelves/, but normally I would suggest hg unshelve follow by hg revert.

  2. Lorenzo Petrone reporter

    You could have it move the shelve into /tmp instead of deleting it, if you are concerned about permanent instant delete.

    The main problem here is not that it does not have a command to delete the shelve, the main problem is that people will search for it and waste a few minutes before giving up and realizing they can just delete by hand the file in .hg/shelves.

    (yes, that's a rather small issue)

  3. Matt Austin

    I would recommend this as an enhancement as well, and I'm not convinced that having the option to do so is dangerous. In the first instance, if you are looking for a flag to remove the shelf outright, you are already just fine with the idea of losing the shelved data permanently. If you still wanted it, you would have actually committed it.

    I have a first pass at implementing this (via -d/--delete option added to the unshelve command) in my fork at https://bitbucket.org/maafy6/hgshelve/changeset/a2b03224710d

  4. Case Builders

    I agree that deleting a shelved set of changes would be very useful.

    Accidentally typing "hg unshelve -d" (or -remove, like the "hg tag" option, which further reduces the chance of a typo) doesn't seem very likely. It could even ask before deleting it.

    Today I saw that when you have a shelve of a change to a file which no longer exists, there is no way to get rid of the shelved change (related to #6). Having a remove option would be very helpful; I had no idea the shelves are stored in simple plaintext files, nor that it was safe to manually remove them. Also, operating manually on the bookkeeping area is something you generally don't have to do in Mercurial (that's more what I'd expect to have to do in Git); most changes have a command for them.

  5. Log in to comment