hgext3rd/topic/topicmap.py
changeset 1953 bdc5bb223b50
parent 1950 99c1a26abf3f
child 1968 08cbfeb15a1a
--- 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)