[Svnmerge] Fwd: svn commit: r18702 - trunk/contrib/client-side

David James djames at collab.net
Fri Mar 3 17:03:06 PST 2006


---------- Forwarded message ----------
From: djames at tigris.org <djames at tigris.org>
Date: Mar 3, 2006 11:07 AM
Subject: svn commit: r18702 - trunk/contrib/client-side
To: svn at subversion.tigris.org


Author: djames
Date: Fri Mar  3 13:07:36 2006
New Revision: 18702

Modified:
   trunk/contrib/client-side/svnmerge.py
   trunk/contrib/client-side/svnmerge_test.py

Log:
To avoid spurious merge conflicts, restore svnmerge properties from the
merge source before executing a merge, when bidirectional merge support is
enabled. Properties are calculated from our cache, and will only be restored
if the new value differs from the current value.

* contrib/client-side/svnmerge.py

  (action_merge): Restore svnmerge properties before executing merges, when
  bidirectional merge support is enabled.

  (set_props, set_block_props): New functions.

  (set_merge_props): Use set_props, so that our merge property will be deleted
  if no props are supplied.

  (set_blocked_revs): Use set_block_props.

* contrib/client-side/svnmerge_test.py

  (testBidirectionalMerges): Enable --bidirectional flag in test cases. Remove
  unnecessary resolve operation.



Modified: trunk/contrib/client-side/svnmerge.py
Url: http://svn.collab.net/viewcvs/svn/trunk/contrib/client-side/svnmerge.py?rev=18702&p1=trunk/contrib/client-side/svnmerge.py&p2=trunk/contrib/client-side/svnmerge.py&r1=18701&r2=18702
==============================================================================
--- trunk/contrib/client-side/svnmerge.py       (original)
+++ trunk/contrib/client-side/svnmerge.py       Fri Mar  3 13:07:36 2006
@@ -519,21 +519,26 @@
     finally:
         os.remove(fname)

+def set_props(dir, name, props):
+    props = format_merge_props(props)
+    if props:
+        _run_propset(dir, name, props)
+    else:
+        svn_command('propdel "%s" "%s"' % (name, dir))
+
 def set_merge_props(dir, props):
-    _run_propset(dir, opts["prop"], format_merge_props(props))
+    set_props(dir, opts["prop"], props)
+
+def set_block_props(dir, props):
+    set_props(dir, opts["block_prop"], props)

 def set_blocked_revs(dir, head_path, revs):
     props = get_block_props(dir)
     if revs:
         props[head_path] = str(revs)
-    else:
-        if props.has_key(head_path):
-            del props[head_path]
-    props = format_merge_props(props)
-    if props:
-        _run_propset(dir, opts["block_prop"], props)
-    else:
-        svn_command('propdel "%s" "%s"' % (opts["block_prop"], dir))
+    elif props.has_key(head_path):
+        del props[head_path]
+    set_block_props(dir, props)

 def is_url(url):
     """Check if url is a valid url."""
@@ -931,7 +936,17 @@
     # is NOT inclusive so we have to subtract one from start.
     # We try to keep the number of merge operations as low as possible,
     # because it is faster and reduces the number of conflicts.
+    old_merge_props = branch_props
     for start,end in minimal_merge_intervals(revs, phantom_revs):
+
+        # Set merge props appropriately if bidirectional support is enabled
+        if opts["bidirectional"]:
+          new_merge_props = mergeprops[opts["head_url"]].get(start-1)
+          if new_merge_props != old_merge_props:
+              set_merge_props(branch_dir, new_merge_props)
+              old_merge_props = new_merge_props
+
+        # Do the merge
         svn_command('merge -r %d:%d %s %s' % \
                     (start-1, end, opts["head_url"], branch_dir))


Modified: trunk/contrib/client-side/svnmerge_test.py
Url: http://svn.collab.net/viewcvs/svn/trunk/contrib/client-side/svnmerge_test.py?rev=18702&p1=trunk/contrib/client-side/svnmerge_test.py&p2=trunk/contrib/client-side/svnmerge_test.py&r1=18701&r2=18702
==============================================================================
--- trunk/contrib/client-side/svnmerge_test.py  (original)
+++ trunk/contrib/client-side/svnmerge_test.py  Fri Mar  3 13:07:36 2006
@@ -526,18 +526,10 @@
         # Not using switch, so must update to get latest repository rev.
         self.launch("svn update", match=r"At revision 16")

-        self.svnmerge("avail -vv", match=r"15-16$")
-        self.svnmerge("merge -vv", match=r"merge -r 14:16")
+        self.svnmerge("avail -vv --bidirectional", match=r"16$")
+        self.svnmerge("merge -vv --bidirectional", match=r"merge -r 15:16")
         p = self.getproperty()
         self.assertEqual("/trunk:1-16", p)
-
-        # There will be directory property conflict on 'test-branch'
-        # due to the attempted merge from trunk of the addition of the
-        # svnmerge-integrated property, which already exists in the
-        # branch since 'svnmerge.py init' was run in it.  So just
-        # resolve it, as it currently has the correct value (only on
-        # svn 1.3.x, so do not execute a match assertion).
-        self.launch("svn resolved .")

         self.launch("svn commit -F svnmerge-commit-message.txt",
                     match=r"Committed revision 17")

---------------------------------------------------------------------
To unsubscribe, e-mail: svn-unsubscribe at subversion.tigris.org
For additional commands, e-mail: svn-help at subversion.tigris.org



--
David James -- http://www.cs.toronto.edu/~james




More information about the Svnmerge mailing list