Rev 3763: (jam) For 'bzr merge' enable '--reprocess' by default whenever in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Thu Oct 2 18:28:48 BST 2008
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 3763
revision-id: pqm at pqm.ubuntu.com-20081002172844-d6df1l8dzpsqzyup
parent: pqm at pqm.ubuntu.com-20081002163934-wr8i2p311nimbszm
parent: john at arbash-meinel.com-20081002165601-gx13duszt9c425ec
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2008-10-02 18:28:44 +0100
message:
(jam) For 'bzr merge' enable '--reprocess' by default whenever
'--show-base' is not set.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/tests/blackbox/test_merge.py test_merge.py-20060323225809-9bc0459c19917f41
------------------------------------------------------------
revno: 3744.2.2
revision-id: john at arbash-meinel.com-20081002165601-gx13duszt9c425ec
parent: john at arbash-meinel.com-20080929225644-ke56t6jna3lmthut
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: merge_reprocess
timestamp: Thu 2008-10-02 11:56:01 -0500
message:
Merge returns code 1 to indicate there were conflicts.
I didn't notice because I had an older qbzr installed which suppressed
all returncodes.
modified:
bzrlib/tests/blackbox/test_merge.py test_merge.py-20060323225809-9bc0459c19917f41
------------------------------------------------------------
revno: 3744.2.1
revision-id: john at arbash-meinel.com-20080929225644-ke56t6jna3lmthut
parent: pqm at pqm.ubuntu.com-20080926211130-ojyixbni0jpqoify
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: merge_reprocess
timestamp: Mon 2008-09-29 17:56:44 -0500
message:
Change 'bzr merge' so that it uses --reprocess as long as --show-base is not given.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/builtins.py builtins.py-20050830033751-fc01482b9ca23183
bzrlib/tests/blackbox/test_merge.py test_merge.py-20060323225809-9bc0459c19917f41
=== modified file 'NEWS'
--- a/NEWS 2008-10-02 16:39:34 +0000
+++ b/NEWS 2008-10-02 17:28:44 +0000
@@ -15,6 +15,9 @@
towards your mainline. This simplifies the output, makes it faster,
and reduces memory consumption. (John Arbash Meinel)
+ * ``bzr merge`` now defaults to having ``--reprocess`` set, whenever
+ ``--show-base`` is not supplied. (John Arbash Meinel)
+
* ``bzr+http//`` will now optionally load plugins and write logs on the
server. (Marius Kruger)
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2008-10-02 06:18:42 +0000
+++ b/bzrlib/builtins.py 2008-10-02 17:28:44 +0000
@@ -2904,7 +2904,7 @@
]
def run(self, location=None, revision=None, force=False,
- merge_type=None, show_base=False, reprocess=False, remember=False,
+ merge_type=None, show_base=False, reprocess=None, remember=False,
uncommitted=False, pull=False,
directory=None,
preview=False,
@@ -3013,6 +3013,12 @@
not merger.merge_type is _mod_merge.Merge3Merger):
raise errors.BzrCommandError("Show-base is not supported for this"
" merge type. %s" % merger.merge_type)
+ if merger.reprocess is None:
+ if merger.show_base:
+ merger.reprocess = False
+ else:
+ # Use reprocess if the merger supports it
+ merger.reprocess = merger.merge_type.supports_reprocess
if merger.reprocess and not merger.merge_type.supports_reprocess:
raise errors.BzrCommandError("Conflict reduction is not supported"
" for merge type %s." %
=== modified file 'bzrlib/tests/blackbox/test_merge.py'
--- a/bzrlib/tests/blackbox/test_merge.py 2008-08-02 17:10:50 +0000
+++ b/bzrlib/tests/blackbox/test_merge.py 2008-10-02 16:56:01 +0000
@@ -44,6 +44,24 @@
tree.commit(message='setup')
return tree
+ def create_conflicting_branches(self):
+ """Create two branches which have overlapping modifications.
+
+ :return: (tree, other_branch) Where merging other_branch causes a file
+ conflict.
+ """
+ builder = self.make_branch_builder('branch')
+ builder.build_snapshot('rev1', None,
+ [('add', ('', 'root-id', 'directory', None)),
+ ('add', ('fname', 'f-id', 'file', 'a\nb\nc\n'))])
+ builder.build_snapshot('rev2other', ['rev1'],
+ [('modify', ('f-id', 'a\nB\nD\n'))])
+ other = builder.get_branch().bzrdir.sprout('other').open_branch()
+ builder.build_snapshot('rev2this', ['rev1'],
+ [('modify', ('f-id', 'a\nB\nC\n'))])
+ tree = builder.get_branch().create_checkout('tree', lightweight=True)
+ return tree, other
+
def test_merge_reprocess(self):
d = BzrDir.create_standalone_workingtree('.')
d.commit('h')
@@ -101,6 +119,61 @@
self.run_bzr('merge ../b -r last:1')
self.assertEqual([a_tip], a.get_parent_ids())
+ def test_merge_defaults_to_reprocess(self):
+ tree, other = self.create_conflicting_branches()
+ # The default merge algorithm should enable 'reprocess' because
+ # 'show-base' is not set
+ self.run_bzr('merge ../other', working_dir='tree',
+ retcode=1)
+ self.assertEqualDiff('a\n'
+ 'B\n'
+ '<<<<<<< TREE\n'
+ 'C\n'
+ '=======\n'
+ 'D\n'
+ '>>>>>>> MERGE-SOURCE\n',
+ tree.get_file_text('f-id'))
+
+ def test_merge_explicit_reprocess_show_base(self):
+ tree, other = self.create_conflicting_branches()
+ # Explicitly setting --reprocess, and --show-base is an error
+ self.run_bzr_error(['Cannot do conflict reduction and show base'],
+ 'merge ../other --reprocess --show-base',
+ working_dir='tree')
+
+ def test_merge_override_reprocess(self):
+ tree, other = self.create_conflicting_branches()
+ # Explicitly disable reprocess
+ self.run_bzr('merge ../other --no-reprocess', working_dir='tree',
+ retcode=1)
+ self.assertEqualDiff('a\n'
+ '<<<<<<< TREE\n'
+ 'B\n'
+ 'C\n'
+ '=======\n'
+ 'B\n'
+ 'D\n'
+ '>>>>>>> MERGE-SOURCE\n',
+ tree.get_file_text('f-id'))
+
+ def test_merge_override_show_base(self):
+ tree, other = self.create_conflicting_branches()
+ # Setting '--show-base' will auto-disable '--reprocess'
+ self.run_bzr('merge ../other --show-base', working_dir='tree',
+ retcode=1)
+ self.assertEqualDiff('a\n'
+ '<<<<<<< TREE\n'
+ 'B\n'
+ 'C\n'
+ '||||||| BASE-REVISION\n'
+ 'b\n'
+ 'c\n'
+ '=======\n'
+ 'B\n'
+ 'D\n'
+ '>>>>>>> MERGE-SOURCE\n',
+ tree.get_file_text('f-id'))
+
def test_merge_with_missing_file(self):
"""Merge handles missing file conflicts"""
self.build_tree_contents([
More information about the bazaar-commits
mailing list