Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to undo an import in subversion?

Tags:

svn

By accident I called "svn import ..." in the wrong directory. Is there a sensible way to undo this mistake?

Googling I didn't find any useful answer, and the closest to my problem I found on stackoverflow was importing the correct data to the wrong place, whereas I imported the wrong data to the correct place.

And: the repository is NOT new, so deleting it is out of question.

It would be a kind of ironic, if I couldn't undo operations in a version control system. So can someone help me? (Thanks!)

EDIT: I got my repository stored in a Berkley Database, i.e., it's in the file system. Looking at the modification date of all files/directories and at the content of the just modified files I was able to work out what to do except for one thing: does anybody know what's the file txn-current is for? I guess it's connected to the transaction handling, but what's the meaning of its content (length is 2 bytes)?

EDIT 2: Thanks for both helpful answers. I accepted Martin's answer as it should provide the proper way of doing it (as I'm under time pressure I just deleted some files as hinted in my first EDIT ignoring the content of txn-current and live fine with until now). But check out the link Wim gave in his comment!

like image 775
j.p. Avatar asked Feb 21 '10 14:02

j.p.


People also ask

How do I undo changes in svn?

If you want to undo all changes you made in a file since the last update you need to select the file, right click to pop up the context menu and then select the command TortoiseSVN → Revert A dialog will pop up showing you the files that you've changed and can revert.

Can we revert commit in svn?

Note that the svn merge command reverts a commit in the sense of having another commit undoing your changes, but keeping your wrong commit in the history.

What is svn revert option?

svn revert will revert not only the contents of an item in your working copy, but also any property changes. Finally, you can use it to undo any scheduling operations that you may have performed (e.g., files scheduled for addition or deletion can be “unscheduled”).

How do I undo a merge in svn?

To revert (SVN lingo: reverse-merge) a range, simply swap the start and end revisions, e.g. -r 76100:76077 to revert -r 76077:76100 . To revert a single revision, use a negative revision ID, e.g. -c -76077 to revert r76077 (this is equivalent to -r 76077:76076 ).


1 Answers

You can't undo a commit directly, the only option for this is to do an svnadmin dump, remove the commit from the dumpfile (either by hand using a text editor, or using svndumpfilter, and svnadmin load it again.

If it's not a real problem that the data stays somewhere in the repository as an older revision, you can just svn delete it and commit something else instead.

like image 180
Wim Avatar answered Oct 17 '22 01:10

Wim