~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to graph.py

  • Committer: Aaron Bentley
  • Date: 2005-12-03 20:42:25 UTC
  • mfrom: (147.4.25 trunk)
  • mto: (147.4.27 trunk)
  • mto: This revision was merged to the branch mainline in revision 324.
  • Revision ID: aaron.bentley@utoronto.ca-20051203204225-25678bc921de4fc1
MergeĀ fromĀ lifeless

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
1
17
from dotgraph import Node, dot_output, invoke_dot, invoke_dot_aa, NoDot, NoRsvg
2
18
from dotgraph import RSVG_OUTPUT_TYPES, DOT_OUTPUT_TYPES, Edge, invoke_dot_html
3
19
from bzrlib.branch import Branch
99
115
        object.__init__(self)
100
116
        self.branch = branch
101
117
        self.other_branch = other_branch
102
 
        revision_a = self.branch.last_patch()
 
118
        revision_a = self.branch.last_revision()
103
119
        if other_branch is not None:
104
120
            greedy_fetch(branch, other_branch)
105
 
            revision_b = self.other_branch.last_patch()
 
121
            revision_b = self.other_branch.last_revision()
106
122
            try:
107
123
                self.root, self.ancestors, self.descendants, self.common = \
108
124
                    combined_graph(revision_a, revision_b, self.branch)
216
232
 
217
233
def write_ancestry_file(branch, filename, collapse=True, antialias=True,
218
234
                        merge_branch=None, ranking="forced"):
219
 
    b = Branch.open_containing(branch)
 
235
    b = Branch.open_containing(branch)[0]
220
236
    if merge_branch is not None:
221
 
        m = Branch.open_containing(merge_branch)
 
237
        m = Branch.open_containing(merge_branch)[0]
222
238
    else:
223
239
        m = None
224
 
    grapher = Grapher(b, m)
225
 
    relations = grapher.get_relations(collapse)
 
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()
226
252
 
227
253
    ext = filename.split('.')[-1]
228
254
    output = dot_output(relations, ranking)