On Jul 20, 2007, at 17:03, Emin.shopper Martinian.shopper wrote:
> Almost all the documentation I've seen on svn merge suggests using
> a revision number for things to merge. Is this really necessary?
It depends on what you want, but often, yes, this is really
necessary, until Subversion gets merge tracking, which is currently
in development.
> Let's say I create a branch called foo and work on it for a while.
> Then I want to merge it back into the trunk. Can I just do
>
> svn merge <URL-for-branch> <URL-for-trunk> <URL-for-trunk>
>
> to merge it back into the trunk?
First of all, if would be
svn merge <URL-for-branch> <URL-for-trunk> <working-copy-of-trunk>
But no, that will not do what you want, unless you have made no
changes on the trunk since creating the branch, and that's unlikely,
otherwise you would not have bothered to create the branch.
The above command will *do* to the working copy of trunk all the
things you've done on the branch, which is what you want, but will
also *undo* in the trunk working copy any changes you made only on
the trunk, and that's not what you want.
> Similarly, if I want to merge the trunk into the branch, can I just do
>
> svn merge <URL-for-trunk> <URL-for-branch> <URL-for-branch>
Again, it would be:
svn merge <URL-for-trunk> <URL-for-branch> <working-copy-of-branch>
> From my reading of the svn documentation, it seems like svn merge A
> B C should compare A and B and apply the changes to C so this
> should work.
>
> What are the issues that make the svn documentation focus so
> heavily on doing merges by revision number? If your branch has 20
> revisions, doesn't it get painful to have to do a separate merge
> command for each revision?
merge is only a diff and patch. So svn merge A B C will compute the
diff between A and B and apply it to C.
If you want to merge the trunk into the branch, since Subversion does
not have merge tracking yet, you have to tell Subversion how to
construct the diff. In this case, you want to merge the changes that
occurred on the trunk between the revision where you created the
branch, and now, whatever the revision now is, and apply that to the
branch working copy. If you then continue to work on the branch, and
continue to work on the trunk, and later want to again bring changes
from the trunk into the branch, you need to make sure you use the
correct revisions -- you cannot simply start at the revision where
you created the branch again, since those changes have already been
merged. You need to specifically exclude already-merged changes by
beginning at the revision of your last merge.
There are some tools, like svnmerge, that will help automate some of
this for you. But it helps to understand the issues first.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Sat Jul 21 02:12:09 2007