~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to graph.py

  • Committer: Aaron Bentley
  • Date: 2005-10-28 04:43:36 UTC
  • Revision ID: aaron.bentley@utoronto.ca-20051028044336-a3ccb566548fc289
Updated NEWS

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
18
1
from dotgraph import Node, dot_output, invoke_dot, invoke_dot_aa, NoDot, NoRsvg
19
2
from dotgraph import RSVG_OUTPUT_TYPES, DOT_OUTPUT_TYPES, Edge, invoke_dot_html
20
3
from bzrlib.branch import Branch
37
20
            }
38
21
 
39
22
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
 
40
29
def can_skip(rev_id, descendants, ancestors):
41
30
    if rev_id not in descendants:
42
31
        return False
116
105
            revision_b = self.other_branch.last_revision()
117
106
            try:
118
107
                self.root, self.ancestors, self.descendants, self.common = \
119
 
                    combined_graph(revision_a, revision_b,
120
 
                                   self.branch.repository)
 
108
                    combined_graph(revision_a, revision_b, self.branch)
121
109
            except bzrlib.errors.NoCommonRoot:
122
110
                raise bzrlib.errors.NoCommonAncestor(revision_a, revision_b)
123
111
        else:
124
112
            self.root, self.ancestors, self.descendants = \
125
 
                revision_graph(revision_a, branch.repository)
 
113
                revision_graph(revision_a, branch)
126
114
            self.common = []
127
115
 
128
116
        self.n_history = branch.revision_history()
175
163
            color = "#33ff99"
176
164
 
177
165
        label = [name]
178
 
        committer, message, date = get_rev_info(node, self.branch.repository)
 
166
        committer, message, date = get_rev_info(node, self.branch)
179
167
        if committer is not None:
180
168
            label.append(committer)
181
169
 
233
221
        m = Branch.open_containing(merge_branch)[0]
234
222
    else:
235
223
        m = None
236
 
    b.lock_write()
 
224
    b.lock_read()
237
225
    try:
238
226
        if m is not None:
239
227
            m.lock_read()