# HG changeset patch # User Yuya Nishihara # Date 1489978255 -32400 # Node ID d0b9e9803caff5f87020688c49ac6cdf017039d7 # Parent f97e90fa5ad7a8a9d3f2253be6aaed91166a3607 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). diff -r f97e90fa5ad7 -r d0b9e9803caf mercurial/graphmod.py --- a/mercurial/graphmod.py Tue Mar 21 18:36:14 2017 -0400 +++ b/mercurial/graphmod.py Mon Mar 20 11:50:55 2017 +0900 @@ -182,6 +182,9 @@ knownparents = [] newparents = [] for ptype, parent in parents: + if parent == rev: + # self reference (should only be seen in null rev) + continue if parent in seen: knownparents.append(parent) else: @@ -191,8 +194,7 @@ ncols = len(seen) nextseen = seen[:] nextseen[nodeidx:nodeidx + 1] = newparents - edges = [(nodeidx, nextseen.index(p)) - for p in knownparents if p != nullrev] + edges = [(nodeidx, nextseen.index(p)) for p in knownparents] seen[:] = nextseen while len(newparents) > 2: diff -r f97e90fa5ad7 -r d0b9e9803caf tests/test-glog.t --- a/tests/test-glog.t Tue Mar 21 18:36:14 2017 -0400 +++ b/tests/test-glog.t Mon Mar 20 11:50:55 2017 +0900 @@ -3424,3 +3424,39 @@ summary: 0 + $ cd .. + +Multiple roots (issue5440): + + $ hg init multiroots + $ cd multiroots + $ cat < .hg/hgrc + > [ui] + > logtemplate = '{rev} {desc}\n\n' + > EOF + + $ touch foo + $ hg ci -Aqm foo + $ hg co -q null + $ touch bar + $ hg ci -Aqm bar + + $ hg log -Gr null: + @ 1 bar + | + | o 0 foo + |/ + o -1 + + $ hg log -Gr null+0 + o 0 foo + | + o -1 + + $ hg log -Gr null+1 + @ 1 bar + | + o -1 + + + $ cd ..