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

Tree conflicts walk-through - UC4

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Mon, 10 Nov 2008 22:37:49 +0000

This is a walk-through of a tree-conflict scenario that a large
corporate user states as being their most common use case.[1]

Use case 4: Merge a text modification onto a file that has been renamed
(and committed) in the target branch.

  Branch A: modified Foo.c
  Branch B: renamed Foo.c to Bar.c

I set up the scenario with the attached 'uc4.sh'. The following
(slightly edited) transcript starts at the merge command at the end of
that script and follows on manually.

$ # In branch B's WC

$ svn merge file:///home/julianfoad/tmp/svn/uc4/repos/A
--- Merging r2 through r4 into '.':
   C Foo.c
Summary of conflicts:
  Tree conflicts: 1

$ svn status
 M .
! C Foo.c
 M Bar.c

$ svn info Foo.c
Path: Foo.c
Name: Foo.c
Node Kind: none
Tree conflict:
  The merge attempted to edit 'Foo.c'.
'Foo.c' does not exist locally. Maybe you renamed it? Or has it been
renamed in the history of the branch you are merging into?

$ ls
total 4
-rw-r--r-- 1 julianfoad 26 2008-11-10 18:55 Bar.c

$ svn diff

Property changes on: .
Modified: svn:mergeinfo
   Merged /A:r2-4

Property changes on: Bar.c
Deleted: svn:mergeinfo

$ svn ci -m "Try to commit with a conflict"
Sending B
Sending B/Bar.c

Committed revision 5.



"svn merge" detects the conflict and reports it during the merge and at
the end of the merge.

"svn status" reports the conflict.
  Lacking: If there were hundreds of changed files one might want an
easier way to see just the conflicts. For now, one can use "svn status |
grep '^......C'" as a work-around.

"svn info Bar.c" shows details of the conflict.
  Lacking: "svn info -R" doesn't reach this file by recursion.

"ls" shows that only "Bar.c" exists in this directory, as expected.

"svn diff" shows that the file under its new name "Bar.c" does not have
the text changes but does record that incoming change has been merged to
  OK. That's as good as we can expect for now. We assume that I am going
to resolve the conflict which will mean the incoming change will be
merged into it then. Applying the text changes to it automatically or
semi-automatically is a goal for the future. Doing something more clever
with the mergeinfo is an unexplored avenue.

"svn commit" succeeds. Oops.
  BAD! We need to make this fail.

Now I want to resolve the conflict.

Q: what merge did I miss?
A: "svn diff" tells me that "/A:r2-4" is being merged to the root of my
WC. So I want to merge "/A/Foo.c:r2-4" to "Bar.c". Translating to a
merge command, the revision range "2-4" is "-r1:4", so:

$ svn merge -r1:4 ^/A/Foo.c Bar.c
--- Merging r2 through r4 into 'Bar.c':
U Bar.c

$ svn diff Bar.c
Index: Bar.c
--- Bar.c (revision 4)
+++ Bar.c (working copy)
@@ -1 +1,2 @@
 This is the file 'Foo.c'.

Property changes on: Bar.c
Modified: svn:mergeinfo
   Merged /A/Foo.c:r2-4
   Merged /A/Bar.c:r2-4

$ svn st
 M .
! C Foo.c
MM Bar.c

$ svn resolved Foo.c
svn: warning: 'Foo.c' is not under version control

$ svn resolved .
Resolved conflicted state of '.'

$ svn st
 M .
MM Bar.c

$ svn ci -m ""
Sending B
Sending B/Bar.c
Transmitting file data .
Committed revision 5.


"svn merge" successfully puts the text changes in. It doesn't block the
command because of the conflict.
  CAUTION: That wasn't exactly intended behaviour.

"svn diff" shows that changes from both "A/Foo.c" and "A/Bar.c" are now
merged in.
  CAUTION: That wasn't exactly expected behaviour.

"svn resolved" on the parent works as expected.
  TO DO: Resolve per victim.

"svn commit" works.

Other things tried:

"svn revert Foo.c" and "svn revert -R" both revert correctly.

[1] See Use Case 4 in this attachment to issue #2282:

To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org

  • application/x-shellscript attachment: uc4.sh
Received on 2008-11-10 23:38:10 CET

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.