开发者

Is it possible to undo an import in subversion?

开发者 https://www.devze.com 2022-12-20 16:29 出处:网络
By accident I called \"svn import ...\" in the wrong directory. Is there a sensible way to undo this mistake?

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!


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.


If there were no other commits since you imported your files, then you can easily delete the last revision using svn dump.

The following example is taken from this page:

  • (assuming revisions 1-125 are OK, 126 is that last revision, causing the problem)
  • make a backup of the repository, then dump the repository (except the last revision):
    • > svnadmin dump -r1:125 myrepo > my.dump
  • now create a new repository and load the dump:
    • > svnadmin create myrepo
    • > svnadmin load myrepo < my.dump
0

精彩评论

暂无评论...
验证码 换一张
取 消