~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to graph.py

  • Committer: Aaron Bentley
  • Date: 2005-12-14 14:33:05 UTC
  • Revision ID: abentley@panoramicfeedback.com-20051214143305-42718d97f27c03bd
Avoided leaving junk all over the place when running standalone tests.

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
from bzrtools import short_committer
1
18
from dotgraph import Node, dot_output, invoke_dot, invoke_dot_aa, NoDot, NoRsvg
2
19
from dotgraph import RSVG_OUTPUT_TYPES, DOT_OUTPUT_TYPES, Edge, invoke_dot_html
3
20
from bzrlib.branch import Branch
20
37
            }
21
38
 
22
39
committer_alias = {'abentley': 'Aaron Bentley'}
23
 
def short_committer(committer):
24
 
    new_committer = re.sub('<.*>', '', committer).strip(' ')
25
 
    if len(new_committer) < 2:
26
 
        return committer
27
 
    return new_committer
28
 
 
29
40
def can_skip(rev_id, descendants, ancestors):
30
41
    if rev_id not in descendants:
31
42
        return False
221
232
        m = Branch.open_containing(merge_branch)[0]
222
233
    else:
223
234
        m = None
224
 
    grapher = Grapher(b, m)
225
 
    relations = grapher.get_relations(collapse)
 
235
    b.lock_read()
 
236
    try:
 
237
        if m is not None:
 
238
            m.lock_read()
 
239
        try:
 
240
            grapher = Grapher(b, m)
 
241
            relations = grapher.get_relations(collapse)
 
242
        finally:
 
243
            if m is not None:
 
244
                m.unlock()
 
245
    finally:
 
246
        b.unlock()
226
247
 
227
248
    ext = filename.split('.')[-1]
228
249
    output = dot_output(relations, ranking)