[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Problem understanding merging in SVN

From: Francois Beausoleil <fbos_at_users.sourceforge.net>
Date: 2003-04-23 14:55:00 CEST

Hello everyone,

I believe I have not understood properly how to do a merge. I read the
Subversion book and the result of svn merge --help, to no avail. I still
do not
understand in what order I should specify the two URLs. Also, I should
specify
that I have never merged in CVS, so am not polluted by the reverse
thinking
of CVS :-)

Here's the scenario:
Repository follows the standard layout: /repos/trunk, /repos/tags,
/repos/branches. Trunk is used for development and branches is used to
implement patches to released products.

Let's say that I branch two times from one single revision. Let's call
the
branches A and B. So, the repository looks like this:

/repos
   /trunk
      /filea
   /tags
      ...
   /branches
      /A
         /filea
      /B
         /filea

Two developers work on each branch, concurrently. So, in the end, both
branches need to be merged back in trunk. I can merge the first branch
back
in trunk without problem, but when I try to merge the second one, I
do not get the expected result with the expected arguments. Here are the
exact
commands I used, and their results:

# In this script, I made sure that the files would conflict by changing
the
# same line. The original file in trunk was empty, and I added a single
line
# to branches A and B.

E:\wc>svn up
At revision 4.

E:\wc>cd trunk

# In this next line, I believe I am asking SVN to
# "Merge trunk with the changes that occured in A"
E:\wc\trunk>svn merge file:///repos/trunk file:///repos/branches/A
U filea

E:\wc\trunk>cat filea
changes made to A

E:\wc\trunk>svn commit -m "Merged branch A back into trunk"
Sending trunk/filea
Transmitting file data .
Committed revision 5.

# In this next line, I expected SVN to give me a conflict - filea was
updated
# in both branches, and the changes should have conflicted. I certainly
did
# not expect SVN to replace the contents of filea with the changes in
branch B
E:\wc\trunk>svn merge file:///repos/trunk file:///repos/branches/B
U filea

E:\wc\trunk>cat filea
Resolved issues with B branch

E:\wc\trunk>svn revert filea
Reverted filea

# Here, I tried again. The contents of trunk match the contents of
branch A.
# I thought that by asking branch A, I should get the same results as the
# previous command, and I did.
E:\wc\trunk>svn merge file:///repos/branches/A file:///repos/branches/B
U filea

E:\wc\trunk>cat filea
Resolved issues with B branch

E:\wc\trunk>svn revert filea
Reverted filea

# Now, I reversed the order of the arguments. SVN reported no changes !
E:\wc\trunk>svn merge file:///repos/branches/B file:///repos/trunk
   filea

E:\wc\trunk>type filea
changes made to A

As you can see, I might be confused. I believe the examples of merge are
incomplete. Besides, they do not show "real-world" usage. I am ready to
provide better examples for the SVN book so that everyone can understand
properly. I know about the work that was being discussed here concerning
merging and branching, so maybe the rewrite should wait on that. Then
again,
if those changes are to be post-1.0, it might be a good idea to have
merging
better explained.

As I said, I might just have misunderstood something in the way the
arguments
are specified.

Thanks everyone !

Have a nice day !
Francois

--
  Francois Beausoleil
  Developer of Java Gui Builder
  http://jgb.sourceforge.net/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Apr 23 14:56:18 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.