You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Lakshman Srilakshmanan <la...@tradingpost.com.au> on 2006/09/28 06:16:09 UTC
Bug/Inconsistency in merging single files
Hi All,
This is a problem discussed in this forum 6 weeks ago. I have now done
further investigation and would like to present my findings. Old email
trail can be found at
http://www.nabble.com/Merging-and-Ancestry-tf2120346.html#a5919783
In summary I find that single file merges work for updates but **fails**
for add/delete.
Is this a bug or expected behaviour. If it was designed this way, could
someone please tell me the rational behind it.
I have the following structure
/trunk
/branches/ProjectA
/branches/ProjectB
Step1 : I create 4 new files in ProjectA and commit it.
works
Step2 : I simulate (dry-run) undo the work in Step 1
works
Step3 : I simulate (dry-run) undo "one file" from Step 1
*** Fails ***
Step4 : I edit 2 files in ProjectA and commit it
works
Step5 : I simulate (dry-run) undo "one file" from Step 4
works :)
Step6 : I simulate (dry-run) merging from ProjectA into trunk
works
Step7 : I simulate (dry-run) merging "one file" from ProjectA into trunk
*** Fails ***
Step8 : I merge from ProjectA into trunk and commit it
works
Step9 : I simulate (dry-run) merging "one file" from ProjectA into trunk
works :)
Step 1
------
I create 4 new files
lakshman@maggie:~/sgs-ProjectA > svn commit
Adding new1.build
Adding new2.build
Adding (bin) new3.gif
Adding (bin) new4.gif
Transmitting file data ....
Committed revision 24.
Step 2
------
Try a reverse merge dry-run (undo the work done in step 1 above)
lakshman@maggie:~/sgs-ProjectA > svn merge -r24:23 --dry-run
svn://slakshman@maggie/sgs/branches/ProjectA
D new3.gif
D new4.gif
D new1.build
D new2.build
Step 3
------
Try to reverse merge "one file"(undo the work done in step 2 above)
lakshman@maggie:~/sgs-ProjectA > svn merge -r24:23 --dry-run
svn://slakshman@maggie/sgs/branches/ProjectA/new1.build
svn: The location for
'svn://slakshman@maggie/sgs/branches/ProjectA/new1.build' for revision
23 does not exist in the repository or refers to an unrelated object
Step 4
------
Edit new1.build & new2.build
lakshman@maggie:~/sgs-ProjectA > svn commit *
Sending new1.build
Sending new2.build
Transmitting file data ..
Committed revision 25.
Step 5
------
Try to reverse merge "one file"(undo the work done in step 4 above)
lakshman@maggie:~/sgs-ProjectA > svn merge -r25:24 --dry-run
svn://slakshman@maggie/sgs/branches/ProjectA/new1.build
U new1.build
Step 6
------
Try to merge (--dry-run) from ProjectA into trunk
lakshman@maggie:~/sgs-trunk > svn merge -r23:24 --dry-run
svn://slakshman@maggie/sgs/branches/ProjectA
A new3.gif
A new4.gif
A new1.build
A new2.build
Step 7
------
I try to merge (--dry-run) "one file" from ProjectA into trunk
lakshman@maggie:~/sgs-trunk > svn merge -r23:24 --dry-run
svn://slakshman@maggie/sgs/branches/ProjectA/new1.build
svn: Unable to find repository location for
'svn://slakshman@maggie/sgs/branches/ProjectA/new1.build' in revision 23
Step 8
------
I now do the merge from Project A into trunk (similar to Step 6 above)
lakshman@maggie:~/sgs-trunk > svn merge -r23:24
svn://slakshman@maggie/sgs/branches/ProjectA
A new3.gif
A new4.gif
A new1.build
A new2.build
lakshman@maggie:~/sgs-trunk > svn commit *
Adding new1.build
Adding new2.build
Adding (bin) new3.gif
Adding (bin) new4.gif
Committed revision 26.
Step 9
------
I now do a single file merge from Project A into trunk
lakshman@maggie:~/sgs-trunk > svn merge -r24:25 --dry-run
svn://slakshman@maggie/sgs/branches/ProjectA/new1.build
U new1.build
Thanks
Lakshman
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
RE: Bug/Inconsistency in merging single files
Posted by "Reedick, Andrew" <An...@BellSouth.com>.
> -----Original Message-----
> From: Lakshman Srilakshmanan
> [mailto:lakshman.srilakshmanan@tradingpost.com.au]
> Sent: Thursday, September 28, 2006 2:16 AM
> To: users@subversion.tigris.org
> Subject: Bug/Inconsistency in merging single files
>
> Hi All,
>
> This is a problem discussed in this forum 6 weeks ago. I have now done
> further investigation and would like to present my findings. Old email
> trail can be found at
> http://www.nabble.com/Merging-and-Ancestry-tf2120346.html#a5919783
>
>
> In summary I find that single file merges work for updates
> but **fails**
> for add/delete.
>
> Is this a bug or expected behaviour. If it was designed this
> way, could
> someone please tell me the rational behind it.
>
>
Merges in any version control system normally require two passes. The
first pass merges the directory, which will add or remove file objects.
The second pass merges the actual file contents. So you need to merge
the directory non-recursively, revert the other files in the dir, and
then merge the single file.
You can see the two passes when dealing with 'Evil Twins'. 'svn merge'
will list files as being A'dded or D'eleted, whereas 'svn status' will
list the exact same files as being U'pdated or C'onflicted. Ex:
1. Create a branch
svn copy trunk branch
2. Create a pair of evil twins:
svn add branch/foo.java
svn add trunk/foo.java
Evil Twins have the same name, but different histories, version
trees, etc., because they were each created with 'svn add' instead of
'svn copy'. Let's pretend that the branch/foo.java has 5 revisions, and
that the trunk/foo.java has 10 revisions.
3. Note the output of 'svn merge'
svn merge -r 218:219 svn://server/test/trunk/test2/branch
A foo.java
The file was Added in the directory merge pass. This means that the
branch's foo.java (with 5 revisions) replaces the trunk's foo.java
(which as 10 revisions.) Behind the scenes trunk/foo.java was deleted,
and branch/foo.java was 'svn copy'ed to trunk/., hence the 'A
foo.java'.
4. However, 'svn status' tells us that in the second pass (the merging
of the files' contents) that there is a merge conflict.
svn status
? foo.java.working
? foo.java.merge-right.r219
? foo.java.merge-left.r0
C foo.java
So trunk/foo.java now has 6 revisions (5 plus the merge revision)
instead of the original 10.
By comparison, in ClearCase, you have to explicitly merge directories
because directories are first class objects just like files are. You
would run the directory merge repeatedly until there were no items to
merge. (A dir merge could add a new directory, so a second merge would
be needed to merge the newly merged directory, ad infinitum.) Then you
would run a merge to merge just the files.
*****
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential, proprietary, and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers. GA623
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org