/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to annotate/gannotate.py

  • Committer: Aaron Bentley
  • Date: 2006-11-21 14:54:29 UTC
  • mto: (66.6.5 gtk)
  • mto: This revision was merged to the branch mainline in revision 112.
  • Revision ID: abentley@panoramicfeedback.com-20061121145429-v2y9l4i6mcz5qe2d
Use dotted revnos instead of 'merge' where possible

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
import gtk
23
23
import pango
24
24
 
 
25
from bzrlib import tsort
25
26
from bzrlib.errors import NoSuchRevision
26
27
from bzrlib.revision import NULL_REVISION
27
28
 
122
123
        self.annoview.set_cursor(row)
123
124
        self.annoview.scroll_to_cell(row, use_align=True)
124
125
 
 
126
    def _dotted_revnos(self, repository, revision_id):
 
127
        """Return a dict of revision_id -> dotted revno
 
128
        
 
129
        :param repository: The repository to get the graph from
 
130
        :param revision_id: The last revision for which this info is needed
 
131
        """
 
132
        graph = repository.get_revision_graph(revision_id)
 
133
        dotted = {}
 
134
        for n, revision_id, d, revno, e in tsort.merge_sort(graph, 
 
135
            revision_id, generate_revno=True):
 
136
            dotted[revision_id] = '.'.join(str(num) for num in revno)
 
137
        return dotted
 
138
 
125
139
    def _annotate(self, branch, file_id, revision_id):
126
140
        rev_hist = branch.revision_history()
127
141
        repository = branch.repository
128
142
        if revision_id is None:
129
143
            revision_id = branch.last_revision()
 
144
        dotted = self._dotted_revnos(repository, revision_id)
130
145
        rev_tree = repository.revision_tree(revision_id)
131
146
        revision_id = rev_tree.inventory[file_id].revision
132
147
        weave = repository.weave_store.get_weave(file_id,
140
155
                if rev_id in rev_hist:
141
156
                    revno = branch.revision_id_to_revno(rev_id)
142
157
                else:
143
 
                    revno = "merge"
 
158
                    revno = dotted.get(rev_id, "merge")
144
159
            except NoSuchRevision:
145
160
                revision = NoneRevision(rev_id)
146
161
                revno = "?"