# HG changeset patch # User Pierre-Yves David # Date 1459407510 25200 # Node ID bdc5bb223b502b4ce234640a002a97f31578178c # Parent 665d6322994ea3e52d682d2d2d3e79989a2ddf32 commit: wrap "commitstatus" to take topic into account The "created new head" message was appearing for every single commit made on a topic. It should now properly only appears when a new head is actually created on a topic. diff -r 665d6322994e -r bdc5bb223b50 hgext3rd/topic/topicmap.py --- a/hgext3rd/topic/topicmap.py Wed Mar 30 23:55:31 2016 -0700 +++ b/hgext3rd/topic/topicmap.py Wed Mar 30 23:58:30 2016 -0700 @@ -4,6 +4,7 @@ from mercurial import ( branchmap, changegroup, + cmdutil, encoding, error, extensions, @@ -67,6 +68,13 @@ with usetopicmap(repo): return orig(repo, *args, **kwargs) +def commitstatus(orig, repo, node, branch, bheads=None, opts=None): + # wrap commit status use the topic branch heads + ctx = repo[node] + if ctx.topic() and ctx.branch() == branch: + bheads = repo.branchheads("%s:%s" % (branch, ctx.topic())) + return orig(repo, node, branch, bheads=bheads, opts=opts) + class topiccache(oldbranchcache): def __init__(self, *args, **kwargs): @@ -236,3 +244,4 @@ def modsetup(ui): """call at uisetup time to install various wrappings""" extensions.wrapfunction(changegroup.cg1unpacker, 'apply', cgapply) + extensions.wrapfunction(cmdutil, 'commitstatus', commitstatus) diff -r 665d6322994e -r bdc5bb223b50 tests/test-topic-dest.t --- a/tests/test-topic-dest.t Wed Mar 30 23:55:31 2016 -0700 +++ b/tests/test-topic-dest.t Wed Mar 30 23:58:30 2016 -0700 @@ -53,7 +53,6 @@ $ echo zephir >> jungle $ hg add jungle $ hg ci -t monkey -m zephir - created new head $ hg log -G @ 5 (monkey) zephir | @@ -152,7 +151,6 @@ $ echo "General Huc" >> monkeyville $ hg add monkeyville $ hg ci -t monkey -m Huc - created new head $ hg log -G @ 9 (monkey) Huc | @@ -313,10 +311,8 @@ 1 files updated, 0 files merged, 1 files removed, 0 files unresolved $ echo arthur >> jungle $ hg ci -m arthur - created new head $ echo pompadour >> jungle $ hg ci -m pompadour - created new head $ hg up 'roots(all())' 0 files updated, 0 files merged, 6 files removed, 0 files unresolved $ hg log -G diff -r 665d6322994e -r bdc5bb223b50 tests/test-topic-push.t --- a/tests/test-topic-push.t Wed Mar 30 23:55:31 2016 -0700 +++ b/tests/test-topic-push.t Wed Mar 30 23:58:30 2016 -0700 @@ -130,7 +130,6 @@ $ echo aaa > ddd $ hg add ddd $ hg commit -m 'CD' - created new head $ hg log -G # keep track of phase because I saw some strange bug during developement @ 5 default babar draft CD | @@ -187,7 +186,6 @@ $ echo aaa > eee $ hg add eee $ hg commit -m 'CE' - created new head $ hg log -G # keep track of phase because I saw some strange bug during developement @ 6 default celeste draft CE | diff -r 665d6322994e -r bdc5bb223b50 tests/test-topic-stack.t --- a/tests/test-topic-stack.t Wed Mar 30 23:55:31 2016 -0700 +++ b/tests/test-topic-stack.t Wed Mar 30 23:58:30 2016 -0700 @@ -26,15 +26,12 @@ $ echo aaa > ddd $ hg add ddd $ hg commit -m c_d - created new head $ echo aaa > eee $ hg add eee $ hg commit -m c_e - created new head $ echo aaa > fff $ hg add fff $ hg commit -m c_f - created new head $ hg log -G @ 5 default {foo} draft c_f | @@ -149,11 +146,9 @@ $ echo aaa > ggg $ hg add ggg $ hg commit -m c_g - created new head $ echo aaa > hhh $ hg add hhh $ hg commit -m c_h - created new head $ hg log -G @ 11 default {foo} draft c_h | diff -r 665d6322994e -r bdc5bb223b50 tests/test-topic.t --- a/tests/test-topic.t Wed Mar 30 23:55:31 2016 -0700 +++ b/tests/test-topic.t Wed Mar 30 23:58:30 2016 -0700 @@ -91,7 +91,6 @@ narf $ echo 'narf!!!' >> alpha $ hg ci -m 'narf!' - created new head $ hg log -G @ changeset: 6:7c34953036d6 | tag: tip @@ -293,7 +292,6 @@ 1 files updated, 0 files merged, 0 files removed, 0 files unresolved $ echo answer >> alpha $ hg ci -m 'Narf is like `zort` or `poit`!' - created new head $ hg merge narf merging alpha warning: conflicts while merging alpha! (edit, then use 'hg resolve --mark') @@ -305,7 +303,6 @@ (no more unresolved files) $ hg topic narf $ hg ci -m 'Finish narf' - created new head $ hg topics fran * narf