mercurial/exchange.py
changeset 22018 ddb56e7e1b92
parent 22017 7986e99bb69a
child 22019 9fcf772f15ff
equal deleted inserted replaced
22017:7986e99bb69a 22018:ddb56e7e1b92
   189             locallock.release()
   189             locallock.release()
   190 
   190 
   191     _pushbookmark(pushop)
   191     _pushbookmark(pushop)
   192     return pushop.ret
   192     return pushop.ret
   193 
   193 
       
   194 # list of steps to perform discovery before push
       
   195 pushdiscoveryorder = []
       
   196 
       
   197 # Mapping between step name and function
       
   198 #
       
   199 # This exists to help extensions wrap steps if necessary
       
   200 pushdiscoverymapping = {}
       
   201 
       
   202 def pushdiscovery(stepname):
       
   203     """decorator for function performing discovery before push
       
   204 
       
   205     The function is added to the step -> function mapping and appended to the
       
   206     list of steps.  Beware that decorated function will be added in order (this
       
   207     may matter).
       
   208 
       
   209     You can only use this decorator for a new step, if you want to wrap a step
       
   210     from an extension, change the pushdiscovery dictionary directly."""
       
   211     def dec(func):
       
   212         assert stepname not in pushdiscoverymapping
       
   213         pushdiscoverymapping[stepname] = func
       
   214         pushdiscoveryorder.append(stepname)
       
   215         return func
       
   216     return dec
       
   217 
       
   218 
       
   219 
   194 def _pushdiscovery(pushop):
   220 def _pushdiscovery(pushop):
   195     # discovery
   221     """Run all discovery steps"""
       
   222     for stepname in pushdiscoveryorder:
       
   223         step = pushdiscoverymapping[stepname]
       
   224         step(pushop)
       
   225 
       
   226 @pushdiscovery('changeset')
       
   227 def _pushdiscoverychangeset(pushop):
       
   228     """discover the changeset that need to be pushed"""
   196     unfi = pushop.repo.unfiltered()
   229     unfi = pushop.repo.unfiltered()
   197     fci = discovery.findcommonincoming
   230     fci = discovery.findcommonincoming
   198     commoninc = fci(unfi, pushop.remote, force=pushop.force)
   231     commoninc = fci(unfi, pushop.remote, force=pushop.force)
   199     common, inc, remoteheads = commoninc
   232     common, inc, remoteheads = commoninc
   200     fco = discovery.findcommonoutgoing
   233     fco = discovery.findcommonoutgoing