问题
I have a subversion repository, and I would like to create a branch, but the repository does not have the canonical directory structure of /trunk
, /branches
and /tags
- it just has everything that should be in /trunk
, in the root folder.
Am I screwed, or is there some way to correct the directory structure (or to create a branch within the existing directory structure)?
回答1:
Try something along the lines of
$ svn mkdir $REPO/{trunk,tags,branches}
$ for f in $(svn ls $REPO |grep -v 'trunk/$\|tags/$\|branches/$'); do
` svn mv "$f" $REPO/trunk
` done
$ svn cp $REPO/trunk $REPO/branches/branch0
回答2:
Branch in svn is just a reference to a revision (that looks and acts like a complete copy).
So as long as you need to copy all your current trunk somewhere - you have to move all the files from root to subdirectory. Otherwise you have no valid points to copy your files to.
Moving to subdirectory can be performed as creating general directory and copying all the files and directories from the root via svn cp
file by file and directory by directory.
来源:https://stackoverflow.com/questions/6728155/subversion-branching-without-having-canonical-directory-structure