obshashrange: use a small utility function to access the obshash
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Wed, 22 Mar 2017 05:36:45 +0100
changeset 2139 f80fa478e289
parent 2138 393fabaf4039
child 2140 90f8f100dd58
obshashrange: use a small utility function to access the obshash If we want the object to disappear we needs the top level code to stop accessing its attribute.
hgext3rd/evolve/obsdiscovery.py
--- a/hgext3rd/evolve/obsdiscovery.py	Wed Mar 22 05:32:25 2017 +0100
+++ b/hgext3rd/evolve/obsdiscovery.py	Wed Mar 22 05:36:45 2017 +0100
@@ -306,7 +306,7 @@
         sample = []
         for entry, remotehash in replies:
             nbreplies += 1
-            if remotehash == entry.obshash:
+            if remotehash == _obshashrange(local, entry):
                 continue
             elif 1 == len(entry):
                 missing.add(entry.node)
@@ -361,7 +361,7 @@
         n = data[:20]
         index = _unpack('>I', data[20:])[0]
         r = op.repo.changelog.rev(n)
-        rhash = stablerange.stablerange(op.repo, r, index).obshash
+        rhash = _obshashrange(op.repo, stablerange.stablerange(op.repo, r, index))
         replies.append(data + rhash)
         data = inpart.read(24)
     op.reply.newpart('reply:_donotusemeever_evoext_obshashrange_1', data=iter(replies))
@@ -401,9 +401,13 @@
              r.index,
              len(r),
              r.depth,
-             node.short(r.obshash))
+             node.short(_obshashrange(repo, r)))
         ui.status('%3d %s %5d %4d %5d %s\n' % d)
 
+def _obshashrange(repo, rangeid):
+    """return the obsolete hash associated to a range"""
+    return rangeid.obshash
+
 @eh.wrapfunction(obsolete.obsstore, '_addmarkers')
 def _addmarkers(orig, obsstore, *args, **kwargs):
     obsstore.rangeobshashcache.clear()