Rev 5621: (vila) Handle test conflict resolution in subdirs. (Vincent Ladeuil) in file:///home/pqm/archives/thelove/bzr/2.3/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Tue Feb 8 12:50:53 UTC 2011


At file:///home/pqm/archives/thelove/bzr/2.3/

------------------------------------------------------------
revno: 5621 [merge]
revision-id: pqm at pqm.ubuntu.com-20110208125051-fpbdtofhgv7pwzgc
parent: pqm at pqm.ubuntu.com-20110207223840-h0gc81bslkoe6z76
parent: v.ladeuil+lp at free.fr-20110208105310-cdsiwahvwph8iaj6
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.3
timestamp: Tue 2011-02-08 12:50:51 +0000
message:
  (vila) Handle test conflict resolution in subdirs. (Vincent Ladeuil)
modified:
  bzrlib/conflicts.py            conflicts.py-20051001061850-78ef952ba63d2b42
  bzrlib/tests/test_conflicts.py test_conflicts.py-20051006031059-e2dad9bbeaa5891f
  doc/en/release-notes/bzr-2.3.txt NEWS-20050323055033-4e00b5db738777ff
=== modified file 'bzrlib/conflicts.py'
--- a/bzrlib/conflicts.py	2011-01-15 17:29:41 +0000
+++ b/bzrlib/conflicts.py	2011-02-08 10:52:37 +0000
@@ -644,8 +644,9 @@
         winner_tid = tt.trans_id_tree_path(winner_path)
         winner_parent_tid = tt.get_tree_parent(winner_tid)
         # Switch the paths to preserve the content
-        tt.adjust_path(self.path, winner_parent_tid, winner_tid)
-        tt.adjust_path(winner_path, item_parent_tid, item_tid)
+        tt.adjust_path(osutils.basename(self.path),
+                       winner_parent_tid, winner_tid)
+        tt.adjust_path(osutils.basename(winner_path), item_parent_tid, item_tid)
         # Associate the file_id to the right content
         tt.unversion_file(item_tid)
         tt.version_file(self.file_id, winner_tid)
@@ -755,18 +756,15 @@
         pass
 
     def action_take_other(self, tree):
-        # FIXME: We shouldn't have to manipulate so many paths here (and there
-        # is probably a bug or two...)
-        base_path = osutils.basename(self.path)
-        conflict_base_path = osutils.basename(self.conflict_path)
         tt = transform.TreeTransform(tree)
         try:
             p_tid = tt.trans_id_file_id(self.file_id)
             parent_tid = tt.get_tree_parent(p_tid)
             cp_tid = tt.trans_id_file_id(self.conflict_file_id)
             cparent_tid = tt.get_tree_parent(cp_tid)
-            tt.adjust_path(base_path, cparent_tid, cp_tid)
-            tt.adjust_path(conflict_base_path, parent_tid, p_tid)
+            tt.adjust_path(osutils.basename(self.path), cparent_tid, cp_tid)
+            tt.adjust_path(osutils.basename(self.conflict_path),
+                           parent_tid, p_tid)
             tt.apply()
         finally:
             tt.finalize()

=== modified file 'bzrlib/tests/test_conflicts.py'
--- a/bzrlib/tests/test_conflicts.py	2011-01-15 17:31:18 +0000
+++ b/bzrlib/tests/test_conflicts.py	2011-02-08 10:17:38 +0000
@@ -22,6 +22,7 @@
     conflicts,
     errors,
     option,
+    osutils,
     tests,
     )
 from bzrlib.tests import (
@@ -376,17 +377,26 @@
 
     scenarios = mirror_scenarios(
         [
-            # File modified/deleted
+            # File modified on both sides
             (dict(_base_actions='create_file',
                   _path='file', _file_id='file-id'),
              ('filed_modified_A',
               dict(actions='modify_file_A', check='file_has_content_A')),
              ('file_modified_B',
               dict(actions='modify_file_B', check='file_has_content_B')),),
+            # File modified on both sides in dir
+            (dict(_base_actions='create_file_in_dir',
+                  _path='dir/file', _file_id='file-id'),
+             ('filed_modified_A_in_dir',
+              dict(actions='modify_file_A',
+                   check='file_in_dir_has_content_A')),
+             ('file_modified_B',
+              dict(actions='modify_file_B',
+                   check='file_in_dir_has_content_B')),),
             ])
 
-    def do_create_file(self):
-        return [('add', ('file', 'file-id', 'file', 'trunk content\n'))]
+    def do_create_file(self, path='file'):
+        return [('add', (path, 'file-id', 'file', 'trunk content\n'))]
 
     def do_modify_file_A(self):
         return [('modify', ('file-id', 'trunk content\nfeature A\n'))]
@@ -394,11 +404,23 @@
     def do_modify_file_B(self):
         return [('modify', ('file-id', 'trunk content\nfeature B\n'))]
 
-    def check_file_has_content_A(self):
-        self.assertFileEqual('trunk content\nfeature A\n', 'branch/file')
-
-    def check_file_has_content_B(self):
-        self.assertFileEqual('trunk content\nfeature B\n', 'branch/file')
+    def check_file_has_content_A(self, path='file'):
+        self.assertFileEqual('trunk content\nfeature A\n',
+                             osutils.pathjoin('branch', path))
+
+    def check_file_has_content_B(self, path='file'):
+        self.assertFileEqual('trunk content\nfeature B\n',
+                             osutils.pathjoin('branch', path))
+
+    def do_create_file_in_dir(self):
+        return [('add', ('dir', 'dir-id', 'directory', '')),
+            ] + self.do_create_file('dir/file')
+
+    def check_file_in_dir_has_content_A(self):
+        self.check_file_has_content_A('dir/file')
+
+    def check_file_in_dir_has_content_B(self):
+        self.check_file_has_content_B('dir/file')
 
     def _get_resolve_path_arg(self, wt, action):
         return self._path

=== modified file 'doc/en/release-notes/bzr-2.3.txt'
--- a/doc/en/release-notes/bzr-2.3.txt	2011-02-04 22:25:59 +0000
+++ b/doc/en/release-notes/bzr-2.3.txt	2011-02-08 10:53:10 +0000
@@ -32,6 +32,9 @@
 .. Fixes for situations where bzr would previously crash or give incorrect
    or undesirable results.
 
+* Correctly resolve text conflicts for files in subdirs.
+  (Vincent Ladeuil, #715058)
+
 * Restore proper logging of bytes transferred. We accidentally reset the
   counter when commands finished before we logged the total transferred.
   (John Arbash Meinel, #713258)




More information about the bazaar-commits mailing list