I have a small number of non-technical users who use svn for document management. Accidentally committed deletions (of both files and directories) are entirely too common.
Variously, the correct procedure is to revert and or copy from the last revision prior to the deletion. However, I have to look up the procedure each time, and it always takes me about 15 minutes in those bizarre edge-cases where I have to specify the -R rev *in addition to* the @rev notation.
A common operation with a logical process should not be this difficult.
Would it not be incredibly useful to have a shortform of:
svn undelete pathname
Reverting to undo a delete is only applicable if the delete has not yet been committed. Copying from the last revision prior to deletion is only appropriate if the delete has been committed.
Originally Posted by dsjstc
To do what you propose, you need to look at the full history of the repository because pathname no longer exists in HEAD (thus the need for the peg revision). Depending on the size of your repository, this could be a very expensive operation. If multiple instances of pathname are found, which one gets undeleted? What if I want to undelete the item not as it last existed in the repository, but 5 revisions before the deletion?
On the surface, it may seem like a simple process but there are a lot of use cases which haven't been considered yet.
The general case versus the useful case
I don't disagree with you on any particular point. However, the most common case (about 20:1, from my experience) is that the most recent revision was commit-deleted by accident, generally by a casual user with Tortoise.
All I'm saying is that this common edge case could be easily handled with an intuitive name, and without all the complexity required to handle the general case. This is not without precedent -- many unix commands give a shorthand argument for a frequently used option set, such as cp -a.
However, judging by the emptiness of this thread, this issue isn't common among commandline users. I'll bring it up with the tortoise folks.
Tags for this Thread