changeset 1073:f15f02007a0b

obshash: resist to unknown revision during discovery
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 27 Aug 2014 12:02:53 +0200
parents 1639810c11c2
children 442ab25f4747
files hgext/evolve.py hgext/simple4server.py
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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):