diff --git a/hgext3rd/smartlog.py b/hgext3rd/smartlog.py --- a/hgext3rd/smartlog.py +++ b/hgext3rd/smartlog.py @@ -529,7 +529,10 @@ else: branchmaster = masterrev - # Find ancestors of heads that are not in master + # Find all draft ancestors and latest public ancestor of heads + # that are not in master. + # We don't want to draw all public commits because there can be too + # many of them. # Don't use revsets, they are too slow for head in heads: if branchinfo(head)[0] != branch: @@ -540,7 +543,9 @@ current = queue.pop(0) if current not in revs: revs.add(current) - if current != anc: + # stop as soon as we find public commit + ispublic = repo[current].phase() == phases.public + if current != anc and not ispublic: parents = parentrevs(current) for p in parents: if p > anc: diff --git a/tests/test-smartlog.t b/tests/test-smartlog.t --- a/tests/test-smartlog.t +++ b/tests/test-smartlog.t @@ -476,6 +476,46 @@ o -1[curr] 000000000000 1970-01-01 00:00 +0000 +Make sure public commits that are descendants of master are not drawn + $ cd .. + $ hg init repo3 + $ cd repo3 + $ hg debugbuilddag '+5' + $ hg bookmark master -r 1 + $ hg phase --public -r 1 + $ hg smartlog -T compact --all --config smartlog.indentnonpublic=1 + o 4[tip] bebd167eb94d 1970-01-01 00:00 +0000 debugbuilddag + | r4 + | + o 3 2dc09a01254d 1970-01-01 00:00 +0000 debugbuilddag + | r3 + | + o 2 01241442b3c2 1970-01-01 00:00 +0000 debugbuilddag + / r2 + | + o 1[master] 66f7d451a68b 1970-01-01 00:00 +0000 debugbuilddag + | r1 + | + $ hg phase -r 3 --public --force + $ hg up -q 4 + $ hg smartlog -T compact --all --config smartlog.indentnonpublic=1 + @ 4[tip] bebd167eb94d 1970-01-01 00:00 +0000 debugbuilddag + / r4 + | + o 3 2dc09a01254d 1970-01-01 00:00 +0000 debugbuilddag + . r3 + . + o 1[master] 66f7d451a68b 1970-01-01 00:00 +0000 debugbuilddag + | r1 + | + $ hg phase -r 4 --public --force + $ hg smartlog -T compact --all --config smartlog.indentnonpublic=1 + @ 4[tip] bebd167eb94d 1970-01-01 00:00 +0000 debugbuilddag + . r4 + . + o 1[master] 66f7d451a68b 1970-01-01 00:00 +0000 debugbuilddag + | r1 + | Make sure the template keywords are documented correctly $ hg help templates | grep -A1 successor | grep -v predecessors