[Pkg-bazaar-commits] ./bzr-gtk/unstable r436: Use Branch.get_revision_id_to_revno_map in gannotate
Aaron Bentley
aaron at aaronbentley.com
Fri Apr 10 07:44:54 UTC 2009
------------------------------------------------------------
revno: 436
committer: Aaron Bentley <aaron at aaronbentley.com>
branch nick: bzr-gtk
timestamp: Tue 2008-03-04 16:56:23 +0000
message:
Use Branch.get_revision_id_to_revno_map in gannotate
modified:
annotate/gannotate.py
-------------- next part --------------
=== modified file 'annotate/gannotate.py'
--- a/annotate/gannotate.py 2007-11-12 17:11:33 +0000
+++ b/annotate/gannotate.py 2008-03-04 16:56:23 +0000
@@ -80,6 +80,10 @@
try:
branch.lock_read()
branch.repository.lock_read()
+ self.dotted = {}
+ revno_map = self.branch.get_revision_id_to_revno_map()
+ for revision_id, revno in revno_map.iteritems():
+ self.dotted[revision_id] = '.'.join(str(num) for num in revno)
for line_no, (revision, revno, line)\
in enumerate(self._annotate(tree, file_id)):
if revision.revision_id == last_seen and not self.all:
@@ -124,18 +128,6 @@
self.annoview.set_cursor(row)
self.annoview.scroll_to_cell(row, use_align=True)
- def _dotted_revnos(self, repository, revision_id):
- """Return a dict of revision_id -> dotted revno
-
- :param repository: The repository to get the graph from
- :param revision_id: The last revision for which this info is needed
- """
- graph = repository.get_revision_graph(revision_id)
- dotted = {}
- for n, revision_id, d, revno, e in tsort.merge_sort(graph,
- revision_id, generate_revno=True):
- dotted[revision_id] = '.'.join(str(num) for num in revno)
- return dotted
def _annotate(self, tree, file_id):
current_revision = FakeRevision(CURRENT_REVISION)
@@ -150,7 +142,6 @@
revision_id = self.branch.last_revision()
else:
revision_id = self.revision_id
- dotted = self._dotted_revnos(repository, revision_id)
revision_cache = RevisionCache(repository, self.revisions)
for origin, text in tree.annotate_iter(file_id):
rev_id = origin
@@ -160,7 +151,7 @@
else:
try:
revision = revision_cache.get_revision(rev_id)
- revno = dotted.get(rev_id, 'merge')
+ revno = self.dotted.get(rev_id, 'merge')
if len(revno) > 15:
revno = 'merge'
except NoSuchRevision:
More information about the Pkg-bazaar-commits
mailing list