mercurial/phases.py
changeset 15648 79cc89de5be1
parent 15482 a667c89e49b3
child 15649 ca7c4254a21a
equal deleted inserted replaced
15647:ce193147f492 15648:79cc89de5be1
    98         currentroots.intersection_update(ctx.node() for ctx in ctxs)
    98         currentroots.intersection_update(ctx.node() for ctx in ctxs)
    99         if '_phaserev' in vars(repo):
    99         if '_phaserev' in vars(repo):
   100             del repo._phaserev
   100             del repo._phaserev
   101         repo._dirtyphases = True
   101         repo._dirtyphases = True
   102 
   102 
       
   103 
       
   104 def listphases(repo):
       
   105     """List phases root for serialisation over pushkey"""
       
   106     keys = {}
       
   107     for phase in trackedphases:
       
   108         for root in repo._phaseroots[phase]:
       
   109             keys[hex(root)] = '%i' % phase
       
   110     if repo.ui.configbool('phases', 'publish', True):
       
   111         # Add an extra data to let remote know we are a publishing repo.
       
   112         # Publishing repo can't just pretend they are old repo. When pushing to
       
   113         # a publishing repo, the client still need to push phase boundary
       
   114         #
       
   115         # Push do not only push changeset. It also push phase data. New
       
   116         # phase data may apply to common changeset which won't be push (as they
       
   117         # are common).  Here is a very simple example:
       
   118         #
       
   119         # 1) repo A push changeset X as draft to repo B
       
   120         # 2) repo B make changeset X public
       
   121         # 3) repo B push to repo A. X is not pushed but the data that X as now
       
   122         #    public should
       
   123         #
       
   124         # The server can't handle it on it's own as it has no idea of client
       
   125         # phase data.
       
   126         keys['publishing'] = 'True'
       
   127     return keys
       
   128 
       
   129 def pushphase(repo, nhex, oldphasestr, newphasestr):
       
   130     """List phases root for serialisation over pushkey"""
       
   131     lock = repo.lock()
       
   132     try:
       
   133         currentphase = repo[nhex].phase()
       
   134         newphase = abs(int(newphasestr)) # let's avoid negative index surprise
       
   135         oldphase = abs(int(oldphasestr)) # let's avoid negative index surprise
       
   136         if currentphase == oldphase and newphase < oldphase:
       
   137             advanceboundary(repo, newphase, [bin(nhex)])
       
   138             return 1
       
   139         else:
       
   140             return 0
       
   141     finally:
       
   142         lock.release()