hgext/evolve.py
changeset 863 e9693738f234
parent 861 b6337585ae25
child 864 401da1b38cca
--- a/hgext/evolve.py	Tue Mar 04 11:34:38 2014 -0800
+++ b/hgext/evolve.py	Wed Mar 05 16:58:56 2014 -0800
@@ -2304,6 +2304,50 @@
         caps += ' _evoext_pullobsmarkers_0'
     return caps
 
+def _obsrelsethashtree(repo):
+    cache = []
+    unfi = repo.unfiltered()
+    for i in unfi:
+        ctx = unfi[i]
+        entry = 0
+        sha = util.sha1()
+        # add data from p1
+        for p in ctx.parents():
+            p = p.rev()
+            if p < 0:
+                p = nullid
+            else:
+                p = cache[p][1]
+            if p != nullid:
+                entry += 1
+                sha.update(p)
+        tmarkers = repo.obsstore.relevantmarkers([ctx.node()])
+        if tmarkers:
+            bmarkers = [obsolete._encodeonemarker(m) for m in tmarkers]
+            bmarkers.sort()
+            for m in bmarkers:
+                entry += 1
+                sha.update(m)
+        if entry:
+            cache.append((ctx.node(), sha.digest()))
+        else:
+            cache.append((ctx.node(), nullid))
+    return cache
+
+@command('debugobsrelsethashtree',
+        [] , _(''))
+def debugobsrelsethashtree(ui, repo):
+    """display Obsolete markers, Relevant Set, Hash Tree
+    changeset-node obsrelsethashtree-node
+
+    It computed form the "orsht" of its parent and markers
+    relevant to the changeset itself."""
+    for chg, obs in _obsrelsethashtree(repo):
+        ui.status('%s %s\n' % (node.hex(chg), node.hex(obs)))
+
+
+
+
 @eh.extsetup
 def _installwireprotocol(ui):
     localrepo.MODERNCAPS.add('_evoext_pullobsmarkers_0')