78
78
# of a branch appear straight after the fork
79
79
if not found_same and same_branch(revision, parent):
81
colours[parent_id] = colour
82
81
if len(revision.parent_ids) > 1:
83
82
distances[parent_id] = distance + 10
85
84
distances[parent_id] = distance
87
colours[parent_id] = last_colour = last_colour + 1
88
86
distances[parent_id] = distance
90
88
todo.add(parent_id)
170
169
# all children are here, push!
171
170
distances[revid] = len(distances)
172
the_children = children[revision]
173
if len(the_children) == 1:
174
[child] = the_children
175
if len(parent_ids_of[child]) == 1:
176
# one-one relationship between parent and child, same
178
colours[revid] = colours[child.revision_id]
180
# one child with multiple parents, the first parent with
181
# the same committer gets the colour
182
direct_parent = direct_parent_of.get(child)
183
if direct_parent is None:
184
for parent_id in parent_ids_of[child]:
185
parent_revision = revisions[parent_id]
186
if parent_revision.committer == child.committer:
187
direct_parent = parent_revision
188
direct_parent_of[child] = direct_parent
190
if direct_parent == revision:
191
colours[revid] = colours[child.revision_id]
193
colours[revid] = last_colour = last_colour + 1
195
# multiple children, get the colour of the last displayed child
196
# with the same committer which does not already had its colour
199
for child in the_children:
200
if child.committer != revision.committer:
202
if direct_parent_of.get(child) not in (None, revision):
204
available[child] = distances[child.revision_id]
206
sorted_children = sorted(available, key=available.get)
207
child = sorted_children[-1]
208
direct_parent_of[child] = revision
209
colours[revid] = colours[child.revision_id]
211
# no candidate children is available, pick the next colour
212
colours[revid] = last_colour = last_colour + 1
213
# all parents will need to be pushed as soon as possible
172
214
for parent in parent_ids_of[revision]:
173
215
if parent not in pending_ids:
174
216
pending_ids.insert(0, parent)