hgext/states.py
changeset 57 62f2fe22bd42
parent 55 cf4626a13345
child 59 02fba620d139
equal deleted inserted replaced
56:27f9c0d0a996 57:62f2fe22bd42
   181 def pushstatesheads(repo, key, old, new):
   181 def pushstatesheads(repo, key, old, new):
   182     st = STATESMAP[new]
   182     st = STATESMAP[new]
   183     w = repo.wlock()
   183     w = repo.wlock()
   184     try:
   184     try:
   185         newhead = node.bin(key)
   185         newhead = node.bin(key)
   186         repo[newhead]
   186         try:
       
   187             repo[newhead]
       
   188         except error.RepoLookupError:
       
   189             return False
   187         repo.setstate(st, [newhead])
   190         repo.setstate(st, [newhead])
       
   191         return True
   188     finally:
   192     finally:
   189         w.release()
   193         w.release()
   190 
   194 
   191 def liststatesheads(repo):
   195 def liststatesheads(repo):
   192     keys = {}
   196     keys = {}
   405         def _pushstatesheads(self, remote, state, remoteheads):
   409         def _pushstatesheads(self, remote, state, remoteheads):
   406             local = set(self.stateheads(state))
   410             local = set(self.stateheads(state))
   407             missing = local - set(remoteheads)
   411             missing = local - set(remoteheads)
   408             while missing:
   412             while missing:
   409                 h = missing.pop()
   413                 h = missing.pop()
   410                 try:
   414                 ok = remote.pushkey('states-heads', node.hex(h), '', state.name)
   411                     remote.pushkey('states-heads', node.hex(h), '', state.name)
   415                 if not ok:
   412                 except error.RepoLookupError:
       
   413                     missing.update(p.node() for p in repo[h].parents())
   416                     missing.update(p.node() for p in repo[h].parents())
   414 
   417 
   415 
   418 
   416         def _pullstatesheads(self, remote):
   419         def _pullstatesheads(self, remote):
   417             remoteheads = {}
   420             remoteheads = {}