hgext3rd/topic/__init__.py
changeset 1944 daad8249d5cf
parent 1943 cd56f4d8b5a3
child 1945 f4f5bf8b4d17
equal deleted inserted replaced
1943:cd56f4d8b5a3 1944:daad8249d5cf
    16 import re
    16 import re
    17 
    17 
    18 from mercurial.i18n import _
    18 from mercurial.i18n import _
    19 from mercurial import (
    19 from mercurial import (
    20     branchmap,
    20     branchmap,
    21     bundle2,
       
    22     changegroup,
    21     changegroup,
    23     cmdutil,
    22     cmdutil,
    24     commands,
    23     commands,
    25     context,
    24     context,
    26     discovery as discoverymod,
       
    27     error,
    25     error,
    28     exchange,
       
    29     extensions,
    26     extensions,
    30     localrepo,
    27     localrepo,
    31     lock,
    28     lock,
    32     merge,
    29     merge,
    33     namespaces,
    30     namespaces,
    34     node,
    31     node,
    35     obsolete,
    32     obsolete,
    36     patch,
    33     patch,
    37     phases,
    34     phases,
    38     util,
    35     util,
    39     wireproto,
       
    40 )
    36 )
    41 
    37 
    42 from . import (
    38 from . import (
    43     constants,
    39     constants,
    44     revset as topicrevset,
    40     revset as topicrevset,
    91     return []
    87     return []
    92 
    88 
    93 def uisetup(ui):
    89 def uisetup(ui):
    94     destination.modsetup(ui)
    90     destination.modsetup(ui)
    95     topicrevset.modsetup(ui)
    91     topicrevset.modsetup(ui)
       
    92     discovery.modsetup(ui)
    96 
    93 
    97 @contextlib.contextmanager
    94 @contextlib.contextmanager
    98 def usetopicmap(repo):
    95 def usetopicmap(repo):
    99     """use awful monkey patching to update the topic cache"""
    96     """use awful monkey patching to update the topic cache"""
   100     oldbranchcache = branchmap.branchcache
    97     oldbranchcache = branchmap.branchcache
   354 entry[1].append(('t', 'topic', '',
   351 entry[1].append(('t', 'topic', '',
   355                  _("use specified topic"), _('TOPIC')))
   352                  _("use specified topic"), _('TOPIC')))
   356 
   353 
   357 extensions.wrapfunction(cmdutil, 'buildcommittext', committextwrap)
   354 extensions.wrapfunction(cmdutil, 'buildcommittext', committextwrap)
   358 extensions.wrapfunction(merge, 'update', mergeupdatewrap)
   355 extensions.wrapfunction(merge, 'update', mergeupdatewrap)
   359 extensions.wrapfunction(discoverymod, '_headssummary', discovery._headssummary)
       
   360 extensions.wrapfunction(wireproto, 'branchmap', discovery.wireprotobranchmap)
       
   361 extensions.wrapfunction(wireproto, '_capabilities', discovery.wireprotocaps)
       
   362 extensions.wrapfunction(bundle2, 'handlecheckheads', discovery.handlecheckheads)
       
   363 # we need a proper wrape b2 part stuff
       
   364 bundle2.handlecheckheads.params = frozenset()
       
   365 bundle2.parthandlermapping['check:heads'] = bundle2.handlecheckheads
       
   366 extensions.wrapfunction(exchange, '_pushb2phases', discovery._pushb2phases)
       
   367 extensions.wrapfunction(changegroup.cg1unpacker, 'apply', cgapply)
   356 extensions.wrapfunction(changegroup.cg1unpacker, 'apply', cgapply)
   368 exchange.b2partsgenmapping['phase'] = exchange._pushb2phases
       
   369 cmdutil.summaryhooks.add('topic', summaryhook)
   357 cmdutil.summaryhooks.add('topic', summaryhook)
   370 
   358 
   371 if util.safehasattr(cmdutil, 'extraexport'):
   359 if util.safehasattr(cmdutil, 'extraexport'):
   372     cmdutil.extraexport.append('topic')
   360     cmdutil.extraexport.append('topic')
   373     cmdutil.extraexportmap['topic'] = _exporttopic
   361     cmdutil.extraexportmap['topic'] = _exporttopic