Rev 5108: (vila) Properly refuse to obey --take-this and --take-other for text in file:///home/pqm/archives/thelove/bzr/2.2/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Sun Nov 7 11:35:13 GMT 2010
At file:///home/pqm/archives/thelove/bzr/2.2/
------------------------------------------------------------
revno: 5108 [merge]
revision-id: pqm at pqm.ubuntu.com-20101107113511-e2e09dl9fbedjgt9
parent: pqm at pqm.ubuntu.com-20101105100319-o7zkwph6s6vktwie
parent: v.ladeuil+lp at free.fr-20101107102030-t4d2gxwgrlqphw8y
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.2
timestamp: Sun 2010-11-07 11:35:11 +0000
message:
(vila) Properly refuse to obey --take-this and --take-other for text
conflicts. (Vincent Ladeuil)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
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
=== modified file 'NEWS'
--- a/NEWS 2010-10-30 06:59:55 +0000
+++ b/NEWS 2010-11-03 14:00:28 +0000
@@ -19,6 +19,10 @@
Bug Fixes
*********
+* ``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)
+
* Correctly set the Content-Type header when http POSTing to comply
with stricter web frameworks. (Vincent Ladeuil, #655100)
=== modified file 'bzrlib/conflicts.py'
--- a/bzrlib/conflicts.py 2010-05-28 14:15:28 +0000
+++ b/bzrlib/conflicts.py 2010-11-02 14:28:58 +0000
@@ -600,12 +600,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
@@ -614,6 +611,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-05-28 14:15:28 +0000
+++ b/bzrlib/tests/blackbox/test_conflicts.py 2010-11-02 14:28:58 +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.
@@ -126,3 +128,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-07-21 09:15:47 +0000
+++ b/bzrlib/transform.py 2010-11-02 14:28:58 +0000
@@ -645,9 +645,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
More information about the bazaar-commits
mailing list