obshash: resist to unknown revision during discovery
authorPierre-Yves David <pierre-yves.david@fb.com>
Wed, 27 Aug 2014 12:02:53 +0200
changeset 1073 f15f02007a0b
parent 1072 1639810c11c2
child 1074 442ab25f4747
obshash: resist to unknown revision during discovery
hgext/evolve.py
hgext/simple4server.py
--- a/hgext/evolve.py	Wed Aug 27 10:49:58 2014 +0200
+++ b/hgext/evolve.py	Wed Aug 27 12:02:53 2014 +0200
@@ -2238,7 +2238,8 @@
 def _obshash(repo, nodes):
     hashs = _obsrelsethashtree(repo)
     nm = repo.changelog.nodemap
-    return  [hashs[nm.get(n)][1] for n in nodes]
+    revs = [nm.get(n) for n in nodes]
+    return [r is None and nullid or hashs[r][1] for r in revs]
 
 def srv_obshash(repo, proto, nodes):
     return wireproto.encodelist(_obshash(repo, wireproto.decodelist(nodes)))
--- a/hgext/simple4server.py	Wed Aug 27 10:49:58 2014 +0200
+++ b/hgext/simple4server.py	Wed Aug 27 12:02:53 2014 +0200
@@ -226,7 +226,8 @@
     (special case so that all empty are hashed as nullid)"""
     hashs = _obsrelsethashtree(repo)
     nm = repo.changelog.nodemap
-    return  [hashs[nm.get(n)][1] for n in nodes]
+    revs = [nm.get(n) for n in nodes]
+    return [r is None and node.nullid or hashs[r][1] for r in revs]
 
 # from evolve extension: 1a23c7c52a43
 def srv_obshash(repo, proto, nodes):