hgext3rd/topic/topicmap.py
changeset 1953 bdc5bb223b50
parent 1950 99c1a26abf3f
child 1968 08cbfeb15a1a
equal deleted inserted replaced
1952:665d6322994e 1953:bdc5bb223b50
     2 
     2 
     3 from mercurial.node import hex, bin, nullid
     3 from mercurial.node import hex, bin, nullid
     4 from mercurial import (
     4 from mercurial import (
     5     branchmap,
     5     branchmap,
     6     changegroup,
     6     changegroup,
       
     7     cmdutil,
     7     encoding,
     8     encoding,
     8     error,
     9     error,
     9     extensions,
    10     extensions,
    10     scmutil,
    11     scmutil,
    11     util,
    12     util,
    64 
    65 
    65 def cgapply(orig, repo, *args, **kwargs):
    66 def cgapply(orig, repo, *args, **kwargs):
    66     """make sure a topicmap is used when applying a changegroup"""
    67     """make sure a topicmap is used when applying a changegroup"""
    67     with usetopicmap(repo):
    68     with usetopicmap(repo):
    68         return orig(repo, *args, **kwargs)
    69         return orig(repo, *args, **kwargs)
       
    70 
       
    71 def commitstatus(orig, repo, node, branch, bheads=None, opts=None):
       
    72     # wrap commit status use the topic branch heads
       
    73     ctx = repo[node]
       
    74     if ctx.topic() and ctx.branch() == branch:
       
    75         bheads = repo.branchheads("%s:%s" % (branch, ctx.topic()))
       
    76     return orig(repo, node, branch, bheads=bheads, opts=opts)
    69 
    77 
    70 class topiccache(oldbranchcache):
    78 class topiccache(oldbranchcache):
    71 
    79 
    72     def __init__(self, *args, **kwargs):
    80     def __init__(self, *args, **kwargs):
    73         otherbranchcache = branchmap.branchcache
    81         otherbranchcache = branchmap.branchcache
   234     return partial
   242     return partial
   235 
   243 
   236 def modsetup(ui):
   244 def modsetup(ui):
   237     """call at uisetup time to install various wrappings"""
   245     """call at uisetup time to install various wrappings"""
   238     extensions.wrapfunction(changegroup.cg1unpacker, 'apply', cgapply)
   246     extensions.wrapfunction(changegroup.cg1unpacker, 'apply', cgapply)
       
   247     extensions.wrapfunction(cmdutil, 'commitstatus', commitstatus)