I’m new to SVN so this could be an easy question.
We have a “trunk” with 1st level directories:
10 <-- documents
20 <-- source code, db scripts, ...
30 <-- documents
40 <-- referenced 3rd party library-es
I made a “develop” branch from the “trunk”.
In “develop” we change our source code and after testing it we merge it to “trunk”.
The problem in that in directories “10” and “30” are stored *.doc files that are not needed for development so it is REQUIRED that “develop” branch doesn’t have those directories.
The solution should still:
- allow “svn update” on root folder of “develop” working copy, (20 and 40)
- that update should not re-create
directories 10 and 30 and - of course merging “develop” to “trunk” should NOT delete 10 or 30 in “trunk”.
EDIT:
I forgot to mention that “source code” is not only in 20. There are referenced dll-s and build scripts etc. that are also on 1st level directory, lets say 40.
If I read your question correctly, this is a simple matter of using svn copy to copy only the desired directories into a branch — basically, a combination of answers from Mike Kushner and Ivan Krechetov. I think, however, it might be easier to understand after running through the steps yourself, so the rest of this post will create a sample repository and show the copies and merges.
I’m going to assume that you’re using the “standard” repository layout, which at the top level has three sub-directories, trunk, branches, and tags. And that your 10, 20, 30, and 40 directories are under trunk. In other words:
And, as Mike pointed out, your goal will be to have a structure that looks like this:
It’s unclear from your posting (at least as-of the current edit), but you may have a directory structure in which 10, 20, et al are at the top level. In this case, you’ll need to create a new top-level directory, which I’ll call dev, so that your overall repository looks like the following:
Note that you cannot create dev under 20. Well, physically you can, but you’re almost guaranteed to break your build when doing so.
OK, so let’s walk through an example, in which we create a new repository and put some files in it. You have to be able to run the svnadmin command (which you should be able to do, unless you have a paranoid sysadmin). So pick a temporary directory, and execute the following commands (I’m running Linux; if you’re running Windows the commands will be the same, but you’ll need to put a Windows-specific path in the REPO variable):
This creates a new (empty) repository, and checks out a working copy of it. The second line needs some explanation: it simply creates the repository URL from the current directory. In my workspace directory, the URL looks like this:
OK, now that you’ve got a working copy, let’s create the sample directory structure and some files:
At this point we have the sample directories and two files in them. Here’s the output from find, excluding subversion’s hidden directories:
Next step is to create the sandbox directory, and make copies of the two directories that are going to be in it:
This is the important part: I creating the branch and copies in my working directory, as a copy from the repository. Normally, you just copy
trunkinto a child ofbranches, using svn copy with two repository arguments. That doesn’t work here, because we want only two children oftrunk.After doing this, my working copy looks like this:
At this point, you’d normally check out the development branch into a new working directory and work there. So I’ll do that (after a cd back to my Workspace directory):
And now make some changes:
OK, now it’s time to merge back to the trunk. So go back to the workspace, and check out just the trunk:
And merge from the sandbox. The merge process is described in the Subversion docs:
That last command should show you that only the file
20/change.txtwas affected by the merge. Since you didn’t copy the 10 or 30 directories into the branch, they won’t be touched by the merge.