~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to graph.py

  • Committer: Aaron Bentley
  • Date: 2005-09-23 00:49:22 UTC
  • Revision ID: aaron.bentley@utoronto.ca-20050923004922-ef0340d45b2e3cfe
tweaked Meinel's changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 Aaron Bentley
2
 
# <aaron.bentley@utoronto.ca>
3
 
#
4
 
#    This program is free software; you can redistribute it and/or modify
5
 
#    it under the terms of the GNU General Public License as published by
6
 
#    the Free Software Foundation; either version 2 of the License, or
7
 
#    (at your option) any later version.
8
 
#
9
 
#    This program is distributed in the hope that it will be useful,
10
 
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
#    GNU General Public License for more details.
13
 
#
14
 
#    You should have received a copy of the GNU General Public License
15
 
#    along with this program; if not, write to the Free Software
16
 
#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
1
from dotgraph import Node, dot_output, invoke_dot, invoke_dot_aa, NoDot, NoRsvg
18
2
from dotgraph import RSVG_OUTPUT_TYPES, DOT_OUTPUT_TYPES, Edge, invoke_dot_html
19
3
from bzrlib.branch import Branch
22
6
from bzrlib.graph import node_distances, select_farthest
23
7
from bzrlib.revision import combined_graph, revision_graph
24
8
from bzrlib.revision import MultipleRevisionSources
 
9
from datetime import datetime
25
10
import bzrlib.errors
26
11
import re
27
12
import os.path
98
83
        if rev.message is not None:
99
84
            message = rev.message.split('\n')[0]
100
85
        gmtime = time.gmtime(rev.timestamp + (rev.timezone or 0))
101
 
        date = time.strftime('%Y/%m/%d', gmtime)
 
86
        date = time.strftime('%Y-%m-%d', gmtime)
102
87
    if '@' in committer:
103
88
        try:
104
89
            committer = mail_map[committer]
115
100
        object.__init__(self)
116
101
        self.branch = branch
117
102
        self.other_branch = other_branch
118
 
        revision_a = self.branch.last_revision()
 
103
        revision_a = self.branch.last_patch()
119
104
        if other_branch is not None:
120
105
            greedy_fetch(branch, other_branch)
121
 
            revision_b = self.other_branch.last_revision()
 
106
            revision_b = self.other_branch.last_patch()
122
107
            try:
123
108
                self.root, self.ancestors, self.descendants, self.common = \
124
109
                    combined_graph(revision_a, revision_b, self.branch)
232
217
 
233
218
def write_ancestry_file(branch, filename, collapse=True, antialias=True,
234
219
                        merge_branch=None, ranking="forced"):
235
 
    b = Branch.open_containing(branch)[0]
 
220
    b = Branch.open_containing(branch)
236
221
    if merge_branch is not None:
237
 
        m = Branch.open_containing(merge_branch)[0]
 
222
        m = Branch.open_containing(merge_branch)
238
223
    else:
239
224
        m = None
240
 
    b.lock_read()
241
 
    try:
242
 
        if m is not None:
243
 
            m.lock_read()
244
 
        try:
245
 
            grapher = Grapher(b, m)
246
 
            relations = grapher.get_relations(collapse)
247
 
        finally:
248
 
            if m is not None:
249
 
                m.unlock()
250
 
    finally:
251
 
        b.unlock()
 
225
    grapher = Grapher(b, m)
 
226
    relations = grapher.get_relations(collapse)
252
227
 
253
228
    ext = filename.split('.')[-1]
254
229
    output = dot_output(relations, ranking)