How to add tags/trunk/branches to established SVN repo?

落爺英雄遲暮 提交于 2019-12-22 08:08:07

问题


Lets say you have an established SVN repository with many hundreds of revisions and has been around for upwards of a year. The repository does not have the standard tags, trunk and branches at the top level. Instead it just goes straight into the code.

Is there a way to add in tags, trunk and branches to the repository on the top level without just checking out the entire repository, altering the directory structure and then committing? Is there anyway to add it in recursively so that if you wanted to view a file from a year ago that used to be here:

svn://svn.server.com/myfolder/myfile.txt

instead you would see it here

svn://svn.server.com/trunk/myfolder/myfile.txt

Is this possible? Or do I just have to check everything out, alter the dir structure at the top and commit the whole thing?


回答1:


I believe the only way to do this recursively would to use svnadmin dump, alter the dump file, then import to a clean repo.




回答2:


You don't need to check out the repo to manipulate it.

svn mv svn://svn.server.com/myfolder svn://svn.server.com/trunk
svn mkdir svn://svn.server.com/tags svn://svn.server.com/branches

If immediate commits are scary, you might also be interested in svn checkout --depth='immediates' which will checkout only the files and folders in the target directory--not the contents of the folders. Check out the root with --depth=immediates, arrange directory structure as desired, commit.

There isn't a good way to accomplish the recursive change short of rewriting the entire repo's history.



来源:https://stackoverflow.com/questions/6657337/how-to-add-tags-trunk-branches-to-established-svn-repo

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!