Rev 5531: (vila) Merge 2.2 into trunk including fix for bug #646961 (Vincent in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Sun Nov 7 14:14:45 GMT 2010


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5531 [merge]
revision-id: pqm at pqm.ubuntu.com-20101107141444-r9agveqsbq5mka5u
parent: pqm at pqm.ubuntu.com-20101106181343-uprmjr9pyh43zw1e
parent: v.ladeuil+lp at free.fr-20101107133856-21rzvgfl40q4wxhd
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Sun 2010-11-07 14:14:44 +0000
message:
  (vila) Merge 2.2 into trunk including fix for bug #646961 (Vincent
  	Ladeuil)
modified:
  bzrlib/conflicts.py            conflicts.py-20051001061850-78ef952ba63d2b42
  bzrlib/tests/blackbox/test_conflicts.py test_conflicts.py-20060228151432-9723ebb925b999cf
  bzrlib/tests/test_workingtree.py testworkingtree.py-20051004024258-b88d0fe8f101d468
  bzrlib/transform.py            transform.py-20060105172343-dd99e54394d91687
  doc/en/release-notes/bzr-2.3.txt NEWS-20050323055033-4e00b5db738777ff
=== modified file 'bzrlib/conflicts.py'
--- a/bzrlib/conflicts.py	2010-11-04 17:48:47 +0000
+++ b/bzrlib/conflicts.py	2010-11-07 13:38:56 +0000
@@ -602,12 +602,9 @@
         self._resolve_with_cleanups(tree, 'THIS')
 
 
-# FIXME: TextConflict is about a single file-id, there never is a conflict_path
-# attribute so we shouldn't inherit from PathConflict but simply from Conflict
-
 # TODO: There should be a base revid attribute to better inform the user about
 # how the conflicts were generated.
-class TextConflict(PathConflict):
+class TextConflict(Conflict):
     """The merge algorithm could not resolve all differences encountered."""
 
     has_files = True
@@ -616,6 +613,8 @@
 
     format = 'Text conflict in %(path)s'
 
+    rformat = '%(class)s(%(path)r, %(file_id)r)'
+
     def associated_filenames(self):
         return [self.path + suffix for suffix in CONFLICT_SUFFIXES]
 

=== modified file 'bzrlib/tests/blackbox/test_conflicts.py'
--- a/bzrlib/tests/blackbox/test_conflicts.py	2010-11-04 17:48:47 +0000
+++ b/bzrlib/tests/blackbox/test_conflicts.py	2010-11-07 13:38:56 +0000
@@ -19,6 +19,8 @@
     tests,
     workingtree,
     )
+from bzrlib.tests import script
+
 
 # FIXME: These don't really look at the output of the conflict commands, just
 # the number of lines - there should be more examination.
@@ -131,3 +133,46 @@
         self.assertEqual('', err)
         out, err = self.run_bzr('conflicts')
         self.assertEqual(0, len(out.splitlines()))
+
+class TestResolveSilentlyIgnore(script.TestCaseWithTransportAndScript):
+
+    def test_bug_646961(self):
+        self.run_script("""\
+            $ bzr init base
+            Created a standalone tree (format: 2a)
+            $ cd base
+            $ echo >file1
+            $ bzr add
+            adding file1
+            $ bzr ci -m "stuff"
+            2>Committing to: .../base/
+            2>added file1
+            2>Committed revision 1.
+            $ cd ..
+            $ bzr branch base branch
+            2>Branched 1 revision(s).
+            $ cd base
+            $ echo "1" >> file1
+            $ bzr ci -m "branch 1"
+            2>Committing to: .../base/
+            2>modified file1
+            2>Committed revision 2.
+            $ cd ../branch
+            $ echo "2" >> file1
+            $ bzr ci -m "branch 2"
+            2>Committing to: .../branch/
+            2>modified file1
+            2>Committed revision 2.
+            $ cd ../base
+            $ bzr merge ../branch
+            2> M  file1
+            2>Text conflict in file1
+            2>1 conflicts encountered.
+            # The following succeeds silently without resolving the conflict
+            $ bzr resolve file1 --take-other
+            # The following wil fail when --take-other is implemented
+            # for text conflicts
+            $ bzr conflicts
+            Text conflict in file1
+            """)
+

=== modified file 'bzrlib/tests/test_workingtree.py'
--- a/bzrlib/tests/test_workingtree.py	2010-06-20 11:18:38 +0000
+++ b/bzrlib/tests/test_workingtree.py	2010-11-07 10:20:30 +0000
@@ -349,28 +349,28 @@
         self.build_tree_contents([('this/hello', 'Hello World')])
         this.commit('Add World')
         this.merge_from_branch(other.branch)
-        self.assertEqual([conflicts.TextConflict('hello', None, 'hello_id')],
+        self.assertEqual([conflicts.TextConflict('hello', 'hello_id')],
                          this.conflicts())
         this.auto_resolve()
-        self.assertEqual([conflicts.TextConflict('hello', None, 'hello_id')],
+        self.assertEqual([conflicts.TextConflict('hello', 'hello_id')],
                          this.conflicts())
         self.build_tree_contents([('this/hello', '<<<<<<<')])
         this.auto_resolve()
-        self.assertEqual([conflicts.TextConflict('hello', None, 'hello_id')],
+        self.assertEqual([conflicts.TextConflict('hello', 'hello_id')],
                          this.conflicts())
         self.build_tree_contents([('this/hello', '=======')])
         this.auto_resolve()
-        self.assertEqual([conflicts.TextConflict('hello', None, 'hello_id')],
+        self.assertEqual([conflicts.TextConflict('hello', 'hello_id')],
                          this.conflicts())
         self.build_tree_contents([('this/hello', '\n>>>>>>>')])
         remaining, resolved = this.auto_resolve()
-        self.assertEqual([conflicts.TextConflict('hello', None, 'hello_id')],
+        self.assertEqual([conflicts.TextConflict('hello', 'hello_id')],
                          this.conflicts())
         self.assertEqual([], resolved)
         self.build_tree_contents([('this/hello', 'hELLO wORLD')])
         remaining, resolved = this.auto_resolve()
         self.assertEqual([], this.conflicts())
-        self.assertEqual([conflicts.TextConflict('hello', None, 'hello_id')],
+        self.assertEqual([conflicts.TextConflict('hello', 'hello_id')],
                          resolved)
         self.failIfExists('this/hello.BASE')
 
@@ -378,7 +378,7 @@
         tree = self.make_branch_and_tree('tree')
         self.build_tree(['tree/hello/'])
         tree.add('hello', 'hello-id')
-        file_conflict = conflicts.TextConflict('file', None, 'hello-id')
+        file_conflict = conflicts.TextConflict('file', 'hello-id')
         tree.set_conflicts(conflicts.ConflictList([file_conflict]))
         tree.auto_resolve()
 

=== modified file 'bzrlib/transform.py'
--- a/bzrlib/transform.py	2010-10-15 14:57:42 +0000
+++ b/bzrlib/transform.py	2010-11-07 13:38:56 +0000
@@ -666,9 +666,14 @@
         if (self._new_name, self._new_parent) == ({}, {}):
             return conflicts
         for children in by_parent.itervalues():
-            name_ids = [(self.final_name(t), t) for t in children]
-            if not self._case_sensitive_target:
-                name_ids = [(n.lower(), t) for n, t in name_ids]
+            name_ids = []
+            for child_tid in children:
+                name = self.final_name(child_tid)
+                if name is not None:
+                    # Keep children only if they still exist in the end
+                    if not self._case_sensitive_target:
+                        name = name.lower()
+                    name_ids.append((name, child_tid))
             name_ids.sort()
             last_name = None
             last_trans_id = None

=== modified file 'doc/en/release-notes/bzr-2.3.txt'
--- a/doc/en/release-notes/bzr-2.3.txt	2010-11-06 18:13:43 +0000
+++ b/doc/en/release-notes/bzr-2.3.txt	2010-11-07 13:38:56 +0000
@@ -37,6 +37,10 @@
 .. Fixes for situations where bzr would previously crash or give incorrect
    or undesirable results.
 
+* ``bzr resolve --take-other <file>`` will not crash anymore if ``<file>``
+  is involved in a text conflict (but the conflict is still not
+  resolved). (Vincent Ladeuil, #646961)
+
 * Report error if non-ASCII command option given. (Rory Yorke, #140563)
 
 Documentation




More information about the bazaar-commits mailing list