Rev 4461: Some minor changes in http://bazaar.launchpad.net/~jameinel/bzr/1.17-rework-annotate
John Arbash Meinel
john at arbash-meinel.com
Thu Jun 18 19:32:15 BST 2009
At http://bazaar.launchpad.net/~jameinel/bzr/1.17-rework-annotate
------------------------------------------------------------
revno: 4461
revision-id: john at arbash-meinel.com-20090618183153-za3z1s31rvsmm09l
parent: john at arbash-meinel.com-20090618022000-papy89z58jkbhmj8
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 1.17-rework-annotate
timestamp: Thu 2009-06-18 13:31:53 -0500
message:
Some minor changes
-------------- next part --------------
=== modified file 'bzrlib/_annotator_py.py'
--- a/bzrlib/_annotator_py.py 2009-06-18 02:20:00 +0000
+++ b/bzrlib/_annotator_py.py 2009-06-18 18:31:53 +0000
@@ -62,7 +62,7 @@
matching_blocks = matcher.get_matching_blocks()
return parent_annotations, matching_blocks
- def _reannotate_one_parent(self, annotations, lines, key, parent_key):
+ def _reannotate_one_parent(self, annotations, lines, parent_key):
"""Reannotate this text relative to its first parent."""
parent_annotations, matching_blocks = self._get_parent_annotations_and_matches(
lines, parent_key)
@@ -72,7 +72,8 @@
annotations[lines_idx:lines_idx + match_len] = \
parent_annotations[parent_idx:parent_idx + match_len]
- def _reannotate_other_parents(self, annotations, lines, key, parent_key):
+ def _reannotate_other_parents(self, annotations, lines, this_annotation,
+ parent_key):
"""Reannotate this text relative to a second (or more) parent."""
parent_annotations, matching_blocks = self._get_parent_annotations_and_matches(
lines, parent_key)
@@ -80,7 +81,9 @@
last_ann = None
last_parent = None
last_res = None
- simple_key_ann = (key,)
+ # TODO: consider making all annotations unique and then using 'is'
+ # everywhere. Current results claim that isn't any faster,
+ # because of the time spent deduping
for parent_idx, lines_idx, match_len in matching_blocks:
# For lines which match this parent, we will now resolve whether
# this parent wins over the current annotation
@@ -91,19 +94,17 @@
if ann == par_ann:
# Nothing to change
continue
- if ann == simple_key_ann:
+ if ann == this_annotation:
# Originally claimed 'this', but it was really in this
# parent
annotations[ann_idx] = par_ann
continue
- # Now we have a conflict, both sides claim to have introduced
- # this line
+ # Resolve the fact that both sides have a different value for
+ # last modified
if ann == last_ann and par_ann == last_parent:
annotations[ann_idx] = last_res
else:
new_ann = set(ann)
- assert key not in new_ann
- # new_ann.discard(key)
new_ann.update(par_ann)
new_ann = tuple(sorted(new_ann))
annotations[ann_idx] = new_ann
@@ -118,16 +119,18 @@
for record in self._vf.get_record_stream(keys, 'topological', True):
this_key = record.key
lines = osutils.chunks_to_lines(record.get_bytes_as('chunked'))
- annotations = [(this_key,)]*len(lines)
+ this_annotation = (this_key,)
+ annotations = [this_annotation]*len(lines)
self._lines_cache[this_key] = lines
self._annotations_cache[this_key] = annotations
parents = self._parent_map[this_key]
if not parents:
continue
- self._reannotate_one_parent(annotations, lines, key, parents[0])
+ self._reannotate_one_parent(annotations, lines, parents[0])
for parent in parents[1:]:
- self._reannotate_other_parents(annotations, lines, key, parent)
+ self._reannotate_other_parents(annotations, lines,
+ this_annotation, parent)
try:
annotations = self._annotations_cache[key]
except KeyError:
More information about the bazaar-commits
mailing list