hgext3rd/evolve/obsexchange.py
changeset 2075 a7c0685ba6d9
parent 2063 fd8a7e10b7b3
child 2076 5c6d05c34ba4
equal deleted inserted replaced
2074:081d54b3e7f0 2075:a7c0685ba6d9
    45 obsexcprg = utility.obsexcprg
    45 obsexcprg = utility.obsexcprg
    46 
    46 
    47 
    47 
    48 _bestformat = max(obsolete.formats.keys())
    48 _bestformat = max(obsolete.formats.keys())
    49 
    49 
    50 ##################################
       
    51 ### Control evolve advertising ###
       
    52 ##################################
       
    53 
       
    54 # This is useful to not enable evolution on all repositories on an install
       
    55 
       
    56 def _nslist(orig, repo):
       
    57     rep = orig(repo)
       
    58     if not repo.ui.configbool('__temporary__', 'advertiseobsolete', True):
       
    59         rep.pop('obsolete')
       
    60     return rep
       
    61 
       
    62 @eh.extsetup
       
    63 def extsetup_advertise(ui):
       
    64     extensions.wrapfunction(pushkey, '_nslist', _nslist)
       
    65     pushkey._namespaces['namespaces'] = (lambda *x: False, pushkey._nslist)
       
    66 
       
    67 #####################################################
    50 #####################################################
    68 ### Support for subset specification in getbundle ###
    51 ### Support for subset specification in getbundle ###
    69 #####################################################
    52 #####################################################
    70 
    53 
    71 # Adds support for the 'evo_obscommon' argument to getbundle This argument use
    54 # Adds support for the 'evo_obscommon' argument to getbundle This argument use
   104 
    87 
   105 # manual wrap up in extsetup because of the wireproto.commands mapping
    88 # manual wrap up in extsetup because of the wireproto.commands mapping
   106 def _obscommon_capabilities(orig, repo, proto):
    89 def _obscommon_capabilities(orig, repo, proto):
   107     """wrapper to advertise new capability"""
    90     """wrapper to advertise new capability"""
   108     caps = orig(repo, proto)
    91     caps = orig(repo, proto)
   109     advertise = repo.ui.configbool('__temporary__', 'advertiseobsolete', True)
    92     if obsolete.isenabled(repo, obsolete.exchangeopt):
   110     if obsolete.isenabled(repo, obsolete.exchangeopt) and advertise:
       
   111         caps = caps.split()
    93         caps = caps.split()
   112         caps.append('_evoext_getbundle_obscommon')
    94         caps.append('_evoext_getbundle_obscommon')
   113         caps.sort()
    95         caps.sort()
   114         caps = ' '.join(caps)
    96         caps = ' '.join(caps)
   115     return caps
    97     return caps
   421                                            common=common)
   403                                            common=common)
   422 
   404 
   423 def _legacypush_capabilities(orig, repo, proto):
   405 def _legacypush_capabilities(orig, repo, proto):
   424     """wrapper to advertise new capability"""
   406     """wrapper to advertise new capability"""
   425     caps = orig(repo, proto)
   407     caps = orig(repo, proto)
   426     advertise = repo.ui.configbool('__temporary__', 'advertiseobsolete', True)
   408     if obsolete.isenabled(repo, obsolete.exchangeopt):
   427     if obsolete.isenabled(repo, obsolete.exchangeopt) and advertise:
       
   428         caps = caps.split()
   409         caps = caps.split()
   429         caps.append('_evoext_pushobsmarkers_0')
   410         caps.append('_evoext_pushobsmarkers_0')
   430         caps.append('_evoext_pullobsmarkers_0')
   411         caps.append('_evoext_pullobsmarkers_0')
   431         caps.sort()
   412         caps.sort()
   432         caps = ' '.join(caps)
   413         caps = ' '.join(caps)