# HG changeset patch # User Pierre-Yves David # Date 1459754883 25200 # Node ID d9c7fced94fca96b623c06d20cc6e4c90a6225f6 # Parent a9a1abc7dd759f272dc7e3ac01e16bd2a323cbfe stack: prevent crash when topic is rooted on nullid We exclude null from displayed base. This was causing a crash when trying to display its description (we'll still have to handle the empty description case, but it is now less urgent). diff -r a9a1abc7dd75 -r d9c7fced94fc hgext3rd/topic/stack.py --- a/hgext3rd/topic/stack.py Mon Apr 04 00:22:20 2016 -0700 +++ b/hgext3rd/topic/stack.py Mon Apr 04 00:28:03 2016 -0700 @@ -6,6 +6,7 @@ from mercurial.i18n import _ from mercurial import ( error, + node, obsolete, ) @@ -27,7 +28,7 @@ p1 = ctx.p1() if p1.obsolete(): p1 = repo[_singlesuccessor(repo, p1)] - if p1.rev() != prev: + if p1.rev() != prev and p1.node() != node.nullid: entries.append((None, p1)) entries.append((idx, ctx)) prev = r diff -r a9a1abc7dd75 -r d9c7fced94fc tests/test-topic-stack.t --- a/tests/test-topic-stack.t Mon Apr 04 00:22:20 2016 -0700 +++ b/tests/test-topic-stack.t Mon Apr 04 00:28:03 2016 -0700 @@ -46,7 +46,19 @@ o 0 default {other} draft c_a +Check that topic without any parent does not crash --list +--------------------------------------------------------- + + $ hg up other + switching to topic other + 0 files updated, 0 files merged, 4 files removed, 0 files unresolved + $ hg topic --list + t2@ c_b (current) + t1: c_a $ hg phase --public 'topic("other")' + $ hg up foo + switching to topic foo + 4 files updated, 0 files merged, 0 files removed, 0 files unresolved Simple test -----------