Rev 5991: (jelmer) Fix the thunking of GraphThunkIdsToKeys.merge_sort. (Jelmer in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Tue Jun 21 17:27:33 UTC 2011
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 5991 [merge]
revision-id: pqm at pqm.ubuntu.com-20110621172728-3203vaenqctilpd7
parent: pqm at pqm.ubuntu.com-20110621120745-gnv8az1rjsp0kcnv
parent: jelmer at samba.org-20110620115700-rfcuwpw98dd5368z
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2011-06-21 17:27:28 +0000
message:
(jelmer) Fix the thunking of GraphThunkIdsToKeys.merge_sort. (Jelmer
Vernooij)
modified:
bzrlib/branch.py branch.py-20050309040759-e4baf4e0d046576e
bzrlib/graph.py graph_walker.py-20070525030359-y852guab65d4wtn0-1
bzrlib/tests/test_graph.py test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py 2011-06-01 13:43:12 +0000
+++ b/bzrlib/branch.py 2011-06-20 11:04:42 +0000
@@ -513,7 +513,7 @@
rev_iter = iter(merge_sorted_revisions)
if start_revision_id is not None:
for node in rev_iter:
- rev_id = node.key[-1]
+ rev_id = node.key
if rev_id != start_revision_id:
continue
else:
@@ -525,19 +525,19 @@
if stop_revision_id is None:
# Yield everything
for node in rev_iter:
- rev_id = node.key[-1]
+ rev_id = node.key
yield (rev_id, node.merge_depth, node.revno,
node.end_of_merge)
elif stop_rule == 'exclude':
for node in rev_iter:
- rev_id = node.key[-1]
+ rev_id = node.key
if rev_id == stop_revision_id:
return
yield (rev_id, node.merge_depth, node.revno,
node.end_of_merge)
elif stop_rule == 'include':
for node in rev_iter:
- rev_id = node.key[-1]
+ rev_id = node.key
yield (rev_id, node.merge_depth, node.revno,
node.end_of_merge)
if rev_id == stop_revision_id:
@@ -549,7 +549,7 @@
ancestors = graph.find_unique_ancestors(start_revision_id,
[stop_revision_id])
for node in rev_iter:
- rev_id = node.key[-1]
+ rev_id = node.key
if rev_id not in ancestors:
continue
yield (rev_id, node.merge_depth, node.revno,
@@ -565,7 +565,7 @@
reached_stop_revision_id = False
revision_id_whitelist = []
for node in rev_iter:
- rev_id = node.key[-1]
+ rev_id = node.key
if rev_id == left_parent:
# reached the left parent after the stop_revision
return
=== modified file 'bzrlib/graph.py'
--- a/bzrlib/graph.py 2011-05-20 13:28:35 +0000
+++ b/bzrlib/graph.py 2011-06-20 11:03:53 +0000
@@ -1980,7 +1980,10 @@
return set([h[0] for h in head_keys])
def merge_sort(self, tip_revision):
- return self._graph.merge_sort((tip_revision,))
+ nodes = self._graph.merge_sort((tip_revision,))
+ for node in nodes:
+ node.key = node.key[0]
+ return nodes
def add_node(self, revision, parents):
self._graph.add_node((revision,), [(p,) for p in parents])
=== modified file 'bzrlib/tests/test_graph.py'
--- a/bzrlib/tests/test_graph.py 2011-06-16 13:26:38 +0000
+++ b/bzrlib/tests/test_graph.py 2011-06-20 11:03:53 +0000
@@ -1646,6 +1646,15 @@
self.assertEqual(['B', 'D'],
sorted(graph_thunk.heads(['D', 'B', 'A'])))
+ def test_merge_sort(self):
+ d = {('C',):[('A',)], ('B',): [('A',)], ('A',): []}
+ g = _mod_graph.KnownGraph(d)
+ graph_thunk = _mod_graph.GraphThunkIdsToKeys(g)
+ graph_thunk.add_node("D", ["A", "C"])
+ self.assertEqual([('C', 0, (2,), False), ('A', 0, (1,), True)],
+ [(n.key, n.merge_depth, n.revno, n.end_of_merge)
+ for n in graph_thunk.merge_sort('C')])
+
class TestPendingAncestryResultGetKeys(TestCaseWithMemoryTransport):
"""Tests for bzrlib.graph.PendingAncestryResult."""
=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt 2011-06-21 11:23:40 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt 2011-06-21 17:27:28 +0000
@@ -35,6 +35,9 @@
* Properly load utf8-encoded config files. (Vincent Ladeuil, #799212)
+* ``GraphThunkIdsToKeys.merge_sort`` now properly returns
+ keys rather than ids. (Jelmer Vernooij, #799677)
+
.. Fixes for situations where bzr would previously crash or give incorrect
or undesirable results.
More information about the bazaar-commits
mailing list