~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to graph.py

  • Committer: Aaron Bentley
  • Date: 2007-06-15 19:44:04 UTC
  • Revision ID: abentley@panoramicfeedback.com-20070615194404-aftg1b9up4ve1t3y
Update graph-ancestry to support new graph API

Show diffs side-by-side

added added

removed removed

Lines of Context:
131
131
        if other_branch is not None:
132
132
            self.base = select_farthest(self.distances, self.common)
133
133
            self.m_history = other_branch.revision_history()
 
134
            new_graph = getattr(branch.repository, 'get_graph', lambda: None)()
 
135
            if new_graph is None:
 
136
                self.new_base = None
 
137
                self.lcas = set()
 
138
            else:
 
139
                self.new_base = new_graph.find_unique_lca(revision_a,
 
140
                                                          revision_b)
 
141
                self.lcas = new_graph.find_lca(revision_a, revision_b)
134
142
        else:
135
143
            self.base = None
 
144
            self.new_base = None
 
145
            self.lcas = set()
136
146
            self.m_history = []
137
147
 
138
148
    def dot_node(self, node, num):
171
181
            assert m_rev is not None
172
182
            cluster = "other_history"
173
183
            color = "#ff0000"
 
184
        if node in self.lcas:
 
185
            color = "#9933cc"
174
186
        if node == self.base:
175
 
            color = "#33ff99"
 
187
            color = "#669933"
 
188
            if node == self.new_base:
 
189
                color = "#33ff33"
 
190
        if node == self.new_base:
 
191
            color = '#33cc99'
176
192
 
177
193
        label = [name]
178
194
        committer, message, nick, date = get_rev_info(node,
207
223
        node_relations = []
208
224
        num = 0
209
225
        if collapse:
 
226
            exceptions = self.lcas.union([self.base, self.new_base])
210
227
            visible_ancestors = compact_ancestors(self.descendants,
211
 
                                                  self.ancestors, (self.base,))
 
228
                                                  self.ancestors,
 
229
                                                  exceptions)
212
230
        else:
213
231
            visible_ancestors = self.ancestors
214
232
        if max_distance is not None: