Why doesn't SHELVE work anymore?
Asked by Zteve:

In SourceTree I cannot shelve anything anymore, after I deleted something shelved (called announceVars) I cannot now shelve anything else -- whatever it is named, I get the following error message:

```
hg shelve -y --git --force av abort: No such file or directory: /Users/spowell/dev/rmq/rabbitmq-umbrella/rabbitmq-server/.hg/attic/announceVarsCompleted with errors, see above
```

and no clue as to what is wrong. Notice it refers to the shelf with the original name (which I deleted from the shelved list). Why is this?

There is no help for shelve I can find. Why not?


Answers:
author: stevestreeting
body: Hmm, I haven't seen that particular problem before - I have seen hgattic get confused once before, but dealt with that particular case a while back, this is not quite the same. There's no specific help for shelve/unshelve because it should be very straight forward.

How did you delete 'annouceVars', was it inside SourceTree or elsewhere? Had you applied it beforehand? I'd quite like to identify that so I can prevent this case happening in future.

In any case, the problem is likely to be that hgattic thinks 'announceVars' is still being referenced for some reason. hgattic is actually quite simple, it just puts patch files in .hg/attic, and keeps some state about patches in the simple text files .applied, .current and .saved. It should just be a case of removing any lines in those files which refer to 'announceVars' to get going again.

As I say, it would be nice to know more precisely what steps you took to get to this stage so I can try to prevent it in future, because obviously requiring people to dig around in these files manually is not ideal.

comments: author: stevestreeting
body: Actually, I've figured out how to reproduce this myself:

1. Shelve something
2. Apply the shelved changes but uncheck the 'Delete after applying'
3. Delete the shelved changes
4. Try to shelve something else

The problem is that hgattic doesn't clean up properly if you don't delete the shelf while applying, but then delete later, so I'm going to have to do this manually.

The workaround I posted above should work, this is basically what I'm going to need to make SourceTree do anyway.


author: stevestreeting
body: I've fixed this, it'll miss this week's release but it will be in the build soon. Until the fix makes it into a new build you can avoid the problem by leaving the 'Delete after applying' option checked when you unshelve.


author: Zteve
body: Thanks Steve; I should have made it clearer what I did. I deliberately unchecked the delete while apply option (for the first) because I wanted to apply this shelved patch several times.

I got out of my dead end by deleting the attic directory (fortunately there were no other shelved items I needed), buyt your workaround sounds better. \[I did try to install attic in my cmd line hg, but it simply caused hg to stop working, so I gave that one up.\]

Great response, thanks.


author: Zteve
body: PS: You say "There's no specific help for shelve/unshelve because it should be very straight forward."

I'm sorry, but I think this is just wrong. Every feature should have some help, simple or not, if only to reassure the user that it is an intended, stable part of the product and not some hack, experimental extension, or pirate mod. If you have options on the panels, then help is needed even more so.

In this case there ought to be some background info about applying shelved patches, and why they might not be applicable (and what to do if they're not). (By the way they aren't called patches anywhere the GUI -- that is why I referred to them as shelved items.)

Please consider some help text for this feature. What seems straight forward (sic) to you may be bent backwards to some.


author: stevestreeting
body: A fair point well made. I've been writing help for all the 'major' parts as I add them but you're right that it should be more universal. I'll try harder :)