views:

43

answers:

2

I have two working copies of the same project, each switched to a different branch. Is it possible to merge local changes in one project to the other working copy?

+2  A: 

You could create a patch on one working copy (svn diff) and apply it to the other one (patch). http://ariejan.net/2007/07/03/how-to-create-and-apply-a-patch-with-subversion/

tob
+4  A: 

You can't merge two separate working copies, but there are some things you can do.

If the changes are made to existing files, the easiest way is to create a patch with svn diff, and then just apply that patch to the other working copy. Eg. in the first working copy you do:

svn diff > patch

And then you apply it in the other one:

patch -p0 < patch

And as usual you want to run patch with the --dry-run option to make sure it works first.

However if the branches don't have the same file layout, then you can't just take a patch and apply it. In this case what you need to do is simply just first commit the other local changes, and then use svn merge as usual

reko_t
Is `patch` also a svn command? It looks like it is not installed on my Windows machine.
mklhmnn
Nope, patch is just a generic tool for applying patch files. You can get it for windows here: http://gnuwin32.sourceforge.net/packages/patch.htm
reko_t
You can patch from the TortoiseSVN right click menu if you use TortoiseSVN.
Albin Sunnanbo
Does TortoiseSVN works also for externals, e.g. if I have changes in the (outer) working copy and some in a nested external working copy?
mklhmnn