Rev 3530: Review feedback from Ian. in http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/weave_merge
John Arbash Meinel
john at arbash-meinel.com
Wed Jul 16 17:59:00 BST 2008
At http://bzr.arbash-meinel.com/branches/bzr/1.6-dev/weave_merge
------------------------------------------------------------
revno: 3530
revision-id: john at arbash-meinel.com-20080716165406-3ctahm7c3fafi3qy
parent: john at arbash-meinel.com-20080713043610-od4tckswbijsvakv
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: weave_merge
timestamp: Wed 2008-07-16 11:54:06 -0500
message:
Review feedback from Ian.
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2008-07-09 22:22:35 +0000
+++ b/NEWS 2008-07-16 16:54:06 +0000
@@ -15,7 +15,7 @@
(Martin Pool)
* ``bzr (re)merge --weave`` will now use a real Weave algorithm,
- rather than the annotation-based merged it was using. It does so by
+ rather than the annotation-based merge it was using. It does so by
building up a Weave of the important texts, without needing to build
the full ancestry. (John Arbash Meinel, #238895)
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2008-06-26 00:13:55 +0000
+++ b/bzrlib/builtins.py 2008-07-16 16:54:06 +0000
@@ -3556,7 +3556,10 @@
testament_class = StrictTestament
else:
testament_class = Testament
- b = WorkingTree.open_containing(branch)[0].branch
+ if branch == '.':
+ b = Branch.open_containing(branch)[0]
+ else:
+ b = Branch.open(branch)
b.lock_read()
try:
if revision is None:
=== modified file 'bzrlib/graph.py'
--- a/bzrlib/graph.py 2008-07-13 04:06:16 +0000
+++ b/bzrlib/graph.py 2008-07-16 16:54:06 +0000
@@ -1504,12 +1504,9 @@
if len(node_children) != 1:
continue
child_parents = result.get(node_children[0], None)
- if child_parents is None:
- import pdb; pdb.set_trace()
if len(child_parents) != 1:
# This is not its only parent
continue
- assert child_parents[0] == node
# The child of this node only points at it, and the parent only has
# this as a child. remove this node, and join the others together
result[node_children[0]] = parents
=== modified file 'bzrlib/merge.py'
--- a/bzrlib/merge.py 2008-07-13 04:36:10 +0000
+++ b/bzrlib/merge.py 2008-07-16 16:54:06 +0000
@@ -592,7 +592,7 @@
"""
result = []
iterator = self.other_tree.iter_changes(self.base_tree,
- include_unchanged=False, specific_files=self.interesting_files,
+ include_unchanged=True, specific_files=self.interesting_files,
extra_trees=[self.this_tree])
for (file_id, paths, changed, versioned, parents, names, kind,
executable) in iterator:
@@ -1429,7 +1429,6 @@
# rather than a key tuple. We will just map that directly to no common
# ancestors.
parent_map = {}
- mutter('finding lcas for:\n%s, %s', self.a_rev, self.b_rev)
while True:
next_lcas = self.graph.find_lca(*cur_ancestors)
# Map a plain NULL_REVISION to a simple no-ancestors
@@ -1442,8 +1441,6 @@
for rev_key in cur_ancestors:
ordered_parents = tuple(self.graph.find_merge_order(rev_key,
next_lcas))
- mutter('found %s => %s', rev_key[-1], [p[-1] for p
- in ordered_parents])
parent_map[rev_key] = ordered_parents
if len(next_lcas) == 0:
break
@@ -1453,8 +1450,8 @@
elif len(next_lcas) > 2:
# More than 2 lca's, fall back to grabbing all nodes between
# this and the unique lca.
- mutter('More than 2 LCAs, falling back to all nodes for: %s',
- cur_ancestors)
+ mutter('More than 2 LCAs, falling back to all nodes for:'
+ ' %s, %s\n=> %s', self.a_key, self.b_key, cur_ancestors)
cur_lcas = next_lcas
while len(cur_lcas) > 1:
cur_lcas = self.graph.find_lca(*cur_lcas)
@@ -1579,8 +1576,6 @@
all_revision_keys.add(self.a_key)
all_revision_keys.add(self.b_key)
- if NULL_REVISION in all_revision_keys:
- import pdb; pdb.set_trace()
# Everything else is in 'keys' but get_lines is in 'revision_ids'
all_texts = self.get_lines([k[-1] for k in all_revision_keys])
return all_texts
@@ -1603,7 +1598,6 @@
tip_key = self._key_prefix + (_mod_revision.CURRENT_REVISION,)
parent_map[tip_key] = (self.a_key, self.b_key)
- ordering = []
for seq_num, key, depth, eom in reversed(tsort.merge_sort(parent_map,
tip_key)):
if key == tip_key:
@@ -1611,11 +1605,9 @@
# for key in tsort.topo_sort(parent_map):
parent_keys = parent_map[key]
revision_id = key[-1]
- ordering.append(revision_id)
parent_ids = [k[-1] for k in parent_keys]
self._weave.add_lines(revision_id, parent_ids,
all_texts[revision_id])
- mutter('order in weave: %s', ordering)
def plan_merge(self):
"""Generate a 'plan' for merging the two revisions.
@@ -1634,7 +1626,8 @@
raise AssertionError('There was an invalid head: %s != %s'
% (self.b_key, self._head_key))
plan = 'new-b'
- lines = self.get_lines([self._head_key[-1]])[self._head_key[-1]]
+ head_rev = self._head_key[-1]
+ lines = self.get_lines([head_rev])[head_rev]
return ((plan, line) for line in lines)
return self._weave.plan_merge(self.a_rev, self.b_rev)
=== modified file 'bzrlib/tests/test_graph.py'
--- a/bzrlib/tests/test_graph.py 2008-07-13 04:06:16 +0000
+++ b/bzrlib/tests/test_graph.py 2008-07-16 16:54:06 +0000
@@ -1414,11 +1414,11 @@
# / \
# 4 5
# | |
- # 3 2
+ # 2 3
# \ /
# 1
#
# 4 and 5 cannot be removed because 6 has 2 children
- # 3 and 2 cannot be removed because 1 has 2 parents
+ # 2 and 3 cannot be removed because 1 has 2 parents
d = {1:[2, 3], 2:[4], 4:[6], 3:[5], 5:[6], 6:[7], 7:[]}
self.assertCollapsed(d, d)
=== modified file 'bzrlib/tests/test_merge.py'
--- a/bzrlib/tests/test_merge.py 2008-07-13 04:06:16 +0000
+++ b/bzrlib/tests/test_merge.py 2008-07-16 16:54:06 +0000
@@ -1058,11 +1058,11 @@
self.build_tree_contents([
('other/file1', 'line 1\nline 2 to 2.1\nline 3\nline 4\n'),
])
- other_tree.commit('Swapped 2 & 3')
+ other_tree.commit('Changed 2 to 2.1')
self.build_tree_contents([
('this/file1', 'line 1\nline 3\nline 2\nline 4\n'),
])
- this_tree.commit('Changed 2 to 2.1')
+ this_tree.commit('Swapped 2 & 3')
self.do_merge(this_tree, other_tree)
self.assertFileEqual('line 1\n'
'<<<<<<< TREE\n'
=== modified file 'bzrlib/weave.py'
--- a/bzrlib/weave.py 2008-07-09 21:42:24 +0000
+++ b/bzrlib/weave.py 2008-07-16 16:54:06 +0000
@@ -656,9 +656,6 @@
# not in either revision
yield 'irrelevant', line
- # This doesn't seem to be used anymore
- # yield 'unchanged', '' # terminator
-
def _extract(self, versions):
"""Yield annotation of lines in included set.
More information about the bazaar-commits
mailing list