--- a/hgext/states.py Thu Sep 08 19:07:00 2011 +0200
+++ b/hgext/states.py Fri Sep 09 11:15:44 2011 +0200
@@ -183,8 +183,12 @@
w = repo.wlock()
try:
newhead = node.bin(key)
- repo[newhead]
+ try:
+ repo[newhead]
+ except error.RepoLookupError:
+ return False
repo.setstate(st, [newhead])
+ return True
finally:
w.release()
@@ -407,9 +411,8 @@
missing = local - set(remoteheads)
while missing:
h = missing.pop()
- try:
- remote.pushkey('states-heads', node.hex(h), '', state.name)
- except error.RepoLookupError:
+ ok = remote.pushkey('states-heads', node.hex(h), '', state.name)
+ if not ok:
missing.update(p.node() for p in repo[h].parents())