~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to graph.py

  • Committer: Aaron Bentley
  • Date: 2005-09-22 21:02:05 UTC
  • Revision ID: abentley@panoramicfeedback.com-20050922210205-0405b2f33b2fcab0
Added dates to graph

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
from bzrlib.graph import node_distances, select_farthest
7
7
from bzrlib.revision import combined_graph, revision_graph
8
8
from bzrlib.revision import MultipleRevisionSources
 
9
from datetime import datetime
9
10
import bzrlib.errors
10
11
import re
11
12
import os.path
110
111
            self.base = None
111
112
            self.m_history = []
112
113
 
 
114
    def get_timestamp(self, revision_id):
 
115
        try:
 
116
            return float(self.branch.get_revision(revision_id).timestamp)
 
117
        except NoSuchRevision:
 
118
            return None
 
119
 
113
120
    def dot_node(self, node, num):
114
121
        try:
115
122
            n_rev = self.n_history.index(node) + 1
154
161
        if committer is not None:
155
162
            label.append(committer)
156
163
 
 
164
        timestamp = self.get_timestamp(node)
 
165
        if timestamp is not None:
 
166
            date = datetime.fromtimestamp(timestamp)
 
167
            label.append("%d/%d/%d" % (date.year, date.month, date.day))
 
168
 
157
169
        if node in self.distances:
158
170
            rank = self.distances[node]
159
171
            label.append('d%d' % self.distances[node])