Reputation: 3963
I've accidentally overwritten an old branch by copying trunk over it using 'svn copy'. More specifically, for every release, trunk is branched and kept as a tag, using:
svn copy svn://machine/REPOS/trunk svn://machine/REPOS/tags/$RELEASENR
But this time the value of 'RELEASENR' was that of an old existing branch instead of a new one. Anybody have any ideas on how to undo this mistake? Thanks already!
Upvotes: 17
Views: 7262
Reputation: 567
In order to undo
svn cp OLDFOLDER NEWFOLDER
if the change has not yet been committed, just use
svn revert NEWFOLDER --depth=infinity
Upvotes: 7
Reputation: 9574
Subversion doesn't work that way. You haven't actually overwritten it. If the target of the copy or a move exists and is a directory, then the copied or moved item is placed in that directory:
svn copy svn://machine/REPOS/trunk svn://machine/REPOS/tags/EXISTS_ALREADY
If you look, you should find:
svn://machine/REPOS/tags/EXISTS_ALREADY/trunk
Which is a copy of the trunk you just tried to tag. The fix in this case is easy:
svn mv svn://machine/REPOS/tags/EXISTS_ALREADY/trunk \
svn://machine/REPOS/tags/CORRECT_TAG_NAME
(In case you're not *nix conversant: The \ means I've broken one logical line into two physical lines to spare your horizontal scrollbar from overwork.)
Upvotes: 18
Reputation: 15855
You can undo your last revision by merging back to the previous revision. See http://anilsaldhana.blogspot.com/2007/11/svn-undo-change.html
svn merge --revision 92:91 .
and then commit
Upvotes: 2