Search code examples
svnversion-controlbranchbranching-strategy

svn : how to branch a subdirectory and then later its parent directories


I have branched a subdirectory using:

svn cp --parents trunk/path/to/dir branches/path/to/

After committing this subdirectory, I later would like to branch source code from a parent directory using:

svn cp --parents trunk/path/to branches/path/

However, this returns svn: E150002: Path 'branches/path/to/dir' already exists.

svn cp --parents looks like it internally calls svn mkdir.  

In my case, I often don't know if I'll need the parent directory files in the branch until later on. I could branch all parent directories first, but this could bloat my branch.

What is the correct way to do this while preserving the same directory structure as the source location (e.g., trunk)?  


Solution

  • I found a better way of branching, than the way I was doing it previously. I am now branching the entire trunk on the server side by:

    svn cp <SOURCE URL> <DEST URL> -m "<Comment>"
    

    Then I locally check out only the needed directories using the depth arguments.