diff --git a/mercurial/graphmod.py b/mercurial/graphmod.py --- a/mercurial/graphmod.py +++ b/mercurial/graphmod.py @@ -182,6 +182,9 @@ def asciiedges(type, char, lines, state, 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 @@ def asciiedges(type, char, lines, state, 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 --git a/tests/test-glog.t b/tests/test-glog.t --- a/tests/test-glog.t +++ b/tests/test-glog.t @@ -3424,3 +3424,39 @@ the right node styles are used (issue517 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 ..