comparison mercurial/graphmod.py @ 31558:d0b9e9803caf

graphlog: draw multiple edges towards null node (issue5440) Before, edge (r, null) was processed only once by newparents. However what we really need is just stripping the edge (null, null).
author Yuya Nishihara <yuya@tcha.org>
date Mon, 20 Mar 2017 11:50:55 +0900
parents aea06029919e
children 906da89821ce
comparison
equal deleted inserted replaced
31557:f97e90fa5ad7 31558:d0b9e9803caf
180 nodeidx = seen.index(rev) 180 nodeidx = seen.index(rev)
181 181
182 knownparents = [] 182 knownparents = []
183 newparents = [] 183 newparents = []
184 for ptype, parent in parents: 184 for ptype, parent in parents:
185 if parent == rev:
186 # self reference (should only be seen in null rev)
187 continue
185 if parent in seen: 188 if parent in seen:
186 knownparents.append(parent) 189 knownparents.append(parent)
187 else: 190 else:
188 newparents.append(parent) 191 newparents.append(parent)
189 state['edges'][parent] = state['styles'].get(ptype, '|') 192 state['edges'][parent] = state['styles'].get(ptype, '|')
190 193
191 ncols = len(seen) 194 ncols = len(seen)
192 nextseen = seen[:] 195 nextseen = seen[:]
193 nextseen[nodeidx:nodeidx + 1] = newparents 196 nextseen[nodeidx:nodeidx + 1] = newparents
194 edges = [(nodeidx, nextseen.index(p)) 197 edges = [(nodeidx, nextseen.index(p)) for p in knownparents]
195 for p in knownparents if p != nullrev]
196 198
197 seen[:] = nextseen 199 seen[:] = nextseen
198 while len(newparents) > 2: 200 while len(newparents) > 2:
199 # ascii() only knows how to add or remove a single column between two 201 # ascii() only knows how to add or remove a single column between two
200 # calls. Nodes with more than two parents break this constraint so we 202 # calls. Nodes with more than two parents break this constraint so we