Import exported SVN

2019-09-05 15:11发布

问题:

I have a bit specific question. How would I import an exported SVN repo? I have already read few of the import/export questions around here, but my case is more specific. What I got was an exported SVN repo (with my projects' source), now I need to import it again. How would I do it?

回答1:

I think Dave is right about there being confusion around the meaning of the word export, but there seems to be some confusion as to the commands involved in his answer.

If you have a directory structure in which you see the files that look like the source files in your project, and there are no .svn subdirectories, you have the result of an svn export ... command, and you don't have any repository history, you only have a snapshot of the project. In this case, you create a new subversion repo on your new server using the svnadmin create ... command, and then use svn import .... to commit that snapshot into your new repository.

If you got a single file with a bunch of stuff in it that looks like it has parts of the source code mixed in with lots of other stuff, then you got what is called a "dump file". This dump file contains your project, including all history for that project. In this case, you create your new repository with svnadmin create ..., then load the data into a repository using the svnadmin load ... command.

After that, you will want to use svn co ... to checkout a working copy that you can then develop in.

If what you got was a snapshot of the project, I would encourage you to go back to them and try to get a dump file instead... source control history is valuable.



回答2:

If you don’t have access to the old repository, then the fact that the files are exported from another repository is irrelevant. Just import them as you would any other files that you want to put into Subversion. You will not have any of the old repository’s history.



回答3:

I think there is confusion between "export" here.

In svn world, "export" means to make a copy of a directory structure and remove all suversion metadata (.svn directories and files). If you received this kind of export, then you have a directory structure that is completely independent of subversion (it's no longer under svn control). So you'll need to add this dir structure to svn just as if you were to create a brand new directory with files and need to commit those to subversion

Outside of svn world, "export" sometimes means to create a full backup. In svn, creating a full backup of an entire repository is achieved using svnadmin dump command. If this is the type of export you received, then you probably have a single "dump file". In order to restore a dump file, use the svnadmin load to restore it back into a subversion repository. More specifically, you'll need to upload your copy of the export onto a computer that hosts the subversion repository and then do a svnadmin load. Then, you'll be able to check out the dirs and files as normal.

Hope that helps.



回答4:

If you still have access to the old repository, you can use svnadmin dump to export and svnadmin load to import it, as described in more detail in this post.