changeset 57:62f2fe22bd42

Use dedicated mechanism to report pushkey success
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Fri, 09 Sep 2011 11:15:44 +0200
parents 27f9c0d0a996
children 2ba7355f6e11
files hgext/states.py
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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())