tags:

views:

12

answers:

2

I have svn repository where I have scheduled some files and folders to be moved in the repository with svn mv. I also have some files that are peers of the files to be moved that have local modifications of which I only want a subset of those files to be committed along with the moves.

e.g. the output of svn st would look like:

D      foo/bar
D      foo/bar/a.txt
D      foo/bar/b.txt
M      foo/exclude.txt
M      foo/include.txt
A      foo/whiz/bar
A  +   foo/whiz/bar/c.txt
A  +   foo/whiz/bar/d.txt

To commit to the moves to the repository, I would need to perform the commit on foo but that would also commit the modifications to foo/exclude.txt and foo/include.txt. How would I commit only the deletions/additions as a result of the move plus the mods to foo/include.txt whilst excluding foo/exclude.txt?

I have a feeling the answer lies with the --depth argument to svn ci but it's not clear to me how it will operate.

+2  A: 

Why not commit the individual files rather than the tree?

$ svn ci foo/bar
$ svn ci foo/whiz
...
qor72
That would work, too, but you have a good chance of corrupting your working directory, especially if you're not the only one using the same repository. Furthermore, that is hard to manage when your project files are many. Still, a valid solution.
Xavier Ho
Thanks, that's what I thought (and tried initially) but I made a mistake in one of the paths (more complicated than my example) and the error message from svn led me to think I was doing the wrong thing.
TheJuice
@Xavier Ho: you can specify the individual paths in the same commit command e.g. '$svn ci foo/bar foo/whiz'
TheJuice
@TheJuice: That is true. Problem solved!
Xavier Ho
+1  A: 

With SVN, that behaviour is usually undesired. The short answer is, don't do it.

But of course ther are other ways around it (with SVN):

  • Branch out and then merge back later (painful if you aren't familiar with the process)
  • Delete foo/exclude.txt on the SVN by using svn delete --keep-local would work too, but it would also mean that file will become unversioned until you svn add it again.

What's your use case? Why do you need this behaviour?

Xavier Ho
The use case is being in the middle of some work and then having to change some code for a different reason. I could work around with branching and merging or even (*shudder*) copy my local mods to exclude.txt out, performing the commit and dropping them back on. I was just wondering if there was a way to do this within svn's toolset.
TheJuice