Rev 16: Update the heads testing to be correct. in http://bzr.arbash-meinel.com/plugins/test_graph
John Arbash Meinel
john at arbash-meinel.com
Tue Dec 18 18:37:42 GMT 2007
At http://bzr.arbash-meinel.com/plugins/test_graph
------------------------------------------------------------
revno: 16
revision-id:john at arbash-meinel.com-20071218183511-jlolconm0a4gtuh3
parent: john at arbash-meinel.com-20071218171700-utmo8vbfmgl2xneg
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: test_graph
timestamp: Tue 2007-12-18 12:35:11 -0600
message:
Update the heads testing to be correct.
modified:
graph_testing.py graph_testing.py-20071210194758-1pwa1q7e3wnjf418-2
-------------- next part --------------
=== modified file 'graph_testing.py'
--- a/graph_testing.py 2007-12-18 17:17:00 +0000
+++ b/graph_testing.py 2007-12-18 18:35:11 +0000
@@ -125,15 +125,29 @@
graph = a_branch.repository.get_graph()
t_start = time.clock()
heads = graph.heads(parent_ids)
- t_heads = time.clock() - t_start
+ t_end = time.clock()
+ t_heads = t_end - t_start
+ if t_heads < 0:
+ import pdb; pdb.set_trace()
+ pb.note('negative heads time: %.3fs for %s',
+ t_heads, parent_ids)
finally:
a_branch.unlock()
self.head_times[revision_id] = t_heads
- if heads != set(parent_ids) and heads != set(parent_ids[1:]):
- # We frequently have nodes that are merged back into their
- # base, but the rest should be rare
- pb.note('heads() mismatch for: %s', revision_id)
- self.invalid_heads.add(revision_id)
+ if heads != set(parent_ids):
+ # Check to see that the node really is in the ancestry of the
+ # others
+ non_heads = set(parent_ids) - heads
+ head_ancestries = []
+ for head in heads:
+ ancestry = set(a_branch.repository.get_ancestry(head,
+ topo_sorted=False))
+ for non_head in non_heads:
+ if non_head not in ancestry:
+ pb.note('heads() incorrect for: %s'
+ '\n%s\nwas not in the ancestry',
+ head, non_head)
+ self.invalid_heads.add(revision_id)
a_branch.lock_read()
try:
@@ -143,10 +157,15 @@
for parent_id in parent_ids:
heads = graph.heads((revision_id, parent_id))
assert heads == set([revision_id])
- t_trivial_heads = time.clock() - t_start
+ t_end = time.clock()
+ t_trivial_heads = t_end - t_start
+ if t_trivial_heads < 0:
+ import pdb; pdb.set_trace()
+ pb.note('negative trivial heads time: %.3fs for %s',
+ t_trivial_heads, revision_id)
finally:
a_branch.unlock()
- self.trivial_head_times[revision_id] = t_heads
+ self.trivial_head_times[revision_id] = t_trivial_heads
continue
a_branch.lock_read()
More information about the bazaar-commits
mailing list