# HG changeset patch # User Pierre-Yves David # Date 1394067536 28800 # Node ID e9693738f234491b63462351b28fbe941b3f3e9c # Parent f954e331d5113f9400e882faca84f59c503a1d91 discovery: first version of the "hash tree" idea We build a hash for each node based on the markers that applies to it and the hash of its parent. This will allow a kind of discovery process for markers. diff -r f954e331d511 -r e9693738f234 hgext/evolve.py --- 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')