Commits

Pierre-Yves David  committed b4fa7cc Merge

merge default in to stable

evolve 4.0.0 is coming.

  • Participants
  • Parent commits 35492ab, f80e8e3

Comments (0)

Files changed (40)

 Changelog
 =========
 
+4.0.0 --
+
+- require Mercurial version 3.0.1 or above
+- some compatibility fixes with future 3.1.0
+- deprecated `gup` and `gdown` in favor of prev and next
+- record parent of pruned parent at prune time
+- added a `debugobsstorestat` command to gather data on obsmarker content.
+- added a `debugrecordpruneparents` command to upgrade existing prune marker
+  with parent information. Please run it once per repo after upgrading.
+- improvement to obsolescence marker exchange:
+  - added progress when pushing obsmarkers
+  - added multiple output during obsolescence markers exchange
+  - only push markers relevant to pushed subset
+  - add a new experimental way to exchange marker (when server support):
+    - added progress when pulling obsmarkers
+    - only pull markers relevant to pulled subset
+    - avoid exchanging common markers in some case
+    - use bundle2 as transport when available.
+ - add a hook related to the new commands
+
 3.3.2 -- 2014-05-14
 
 - fix a bug where evolve were creating changeset with 2 parents on windows

File hgext/drophack.py

+# This software may be used and distributed according to the terms of the
+# GNU General Public License version 2 or any later version.
+'''This extension add a hacky command to drop changeset during review
+
+This extension is intended as a temporary hack to allow Matt Mackall to use
+evolve in the Mercurial review it self. You should probably not use it if your
+name is not Matt Mackall.
+'''
+
+import os
+import time
+import contextlib
+
+from mercurial.i18n import _
+from mercurial import cmdutil
+from mercurial import repair
+from mercurial import scmutil
+from mercurial import lock as lockmod
+from mercurial import util
+from mercurial import commands
+
+cmdtable = {}
+command = cmdutil.command(cmdtable)
+
+
+@contextlib.contextmanager
+def timed(ui, caption):
+    ostart = os.times()
+    cstart = time.time()
+    yield
+    cstop = time.time()
+    ostop = os.times()
+    wall = cstop - cstart
+    user = ostop[0] - ostart[0]
+    sys  = ostop[1] - ostart[1]
+    comb = user + sys
+    ui.write("%s: wall %f comb %f user %f sys %f\n"
+             % (caption, wall, comb, user, sys))
+
+def obsmarkerchainfrom(obsstore, nodes):
+    """return all marker chain starting from node
+
+    Starting from mean "use as successors"."""
+    # XXX need something smarter for descendant of bumped changeset
+    seennodes = set(nodes)
+    seenmarkers = set()
+    pendingnodes = set(nodes)
+    precursorsmarkers = obsstore.precursors
+    while pendingnodes:
+        current = pendingnodes.pop()
+        new = set()
+        for precmark in precursorsmarkers.get(current, ()):
+            if precmark in seenmarkers:
+                continue
+            seenmarkers.add(precmark)
+            new.add(precmark[0])
+            yield precmark
+        new -= seennodes
+        pendingnodes |= new
+
+def stripmarker(ui, repo, markers):
+    """remove <markers> from the repo obsstore
+
+    The old obsstore content is saved in a `obsstore.prestrip` file
+    """
+    repo = repo.unfiltered()
+    repo.destroying()
+    oldmarkers = list(repo.obsstore._all)
+    util.rename(repo.sjoin('obsstore'),
+                repo.join('obsstore.prestrip'))
+    del repo.obsstore # drop the cache
+    newstore = repo.obsstore
+    assert not newstore # should be empty after rename
+    newmarkers = [m for m in oldmarkers if m not in markers]
+    tr = repo.transaction('drophack')
+    try:
+        newstore.add(tr, newmarkers)
+        tr.close()
+    finally:
+        tr.release()
+    repo.destroyed()
+
+
+@command('drop', [('r', 'rev', [], 'revision to update')], _('[-r] revs'))
+def cmddrop(ui, repo, *revs, **opts):
+    """I'm hacky do not use me!
+
+    This command strip a changeset, its precursors and all obsolescence marker
+    associated to its chain.
+
+    There is no way to limit the extend of the purge yet. You may have to
+    repull from other source to get some changeset and obsolescence marker
+    back.
+
+    This intended for Matt Mackall usage only. do not use me.
+    """
+    revs = list(revs)
+    revs.extend(opts['rev'])
+    if not revs:
+        revs = ['.']
+    # get the changeset
+    revs = scmutil.revrange(repo, revs)
+    if not revs:
+        ui.write_err('no revision to drop\n')
+        return 1
+    # lock from the beginning to prevent race
+    wlock = lock = None
+    try:
+        lock = repo.wlock()
+        lock = repo.lock()
+        # check they have no children
+        if repo.revs('%ld and public()', revs):
+            ui.write_err('cannot drop public revision')
+            return 1
+        if repo.revs('children(%ld) - %ld', revs, revs):
+            ui.write_err('cannot drop revision with children')
+            return 1
+        if repo.revs('. and %ld', revs):
+            newrevs = repo.revs('max(::. - %ld)', revs)
+            if newrevs:
+                assert len(newrevs) == 1
+                newrev = newrevs[0]
+            else:
+                newrev = -1
+            commands.update(ui, repo, newrev)
+            ui.status(_('working directory now at %s\n') % repo[newrev])
+        # get all markers and successors up to root
+        nodes = [repo[r].node() for r in revs]
+        with timed(ui, 'search obsmarker'):
+            markers = set(obsmarkerchainfrom(repo.obsstore, nodes))
+        ui.write('%i obsmarkers found\n' % len(markers))
+        cl = repo.unfiltered().changelog
+        with timed(ui, 'search nodes'):
+            allnodes = set(nodes)
+            allnodes.update(m[0] for m in markers if cl.hasnode(m[0]))
+        ui.write('%i nodes found\n' % len(allnodes))
+        cl = repo.changelog
+        visiblenodes = set(n for n in allnodes if cl.hasnode(n))
+        # check constraint again
+        if repo.revs('%ln and public()', visiblenodes):
+            ui.write_err('cannot drop public revision')
+            return 1
+        if repo.revs('children(%ln) - %ln', visiblenodes, visiblenodes):
+            ui.write_err('cannot drop revision with children')
+            return 1
+
+        if markers:
+            # strip them
+            with timed(ui, 'strip obsmarker'):
+                stripmarker(ui, repo, markers)
+        # strip the changeset
+        with timed(ui, 'strip nodes'):
+            repair.strip(ui, repo, allnodes, backup="all", topic='drophack')
+
+    finally:
+        lockmod.release(lock, wlock)
+
+    # rewrite the whole file.
+    # print data.
+    # - time to compute the chain
+    # - time to strip the changeset
+    # - time to strip the obs marker.

File hgext/evolve.py

     - improves some aspect of the early implementation in 2.3
 '''
 
-testedwith = '2.7 2.7.1 2.7.2 2.8 2.8.1 2.8.2 2.9 2.9.1 2.9.2 3.0'
+testedwith = '3.0.1'
 buglink = 'https://bitbucket.org/marmoute/mutable-history/issues'
 
 import sys
 import random
+from StringIO import StringIO
+import struct
+import urllib
 
 import mercurial
 from mercurial import util
     from mercurial import obsolete
     if not obsolete._enabled:
         obsolete._enabled = True
-    from mercurial import bookmarks
-    bookmarks.bmstore
+    from mercurial import wireproto
+    gboptslist = getattr(wireproto, 'gboptslist', None)
+    gboptsmap = getattr(wireproto, 'gboptsmap', None)
 except (ImportError, AttributeError):
-    raise util.Abort('Your Mercurial is too old for this version of Evolve',
-                     hint='requires version >> 2.4.x')
+    gboptslist = gboptsmap = None
 
 
-
+from mercurial import base85
 from mercurial import bookmarks
 from mercurial import cmdutil
 from mercurial import commands
 from mercurial import context
 from mercurial import copies
 from mercurial import error
+from mercurial import exchange
 from mercurial import extensions
+from mercurial import httppeer
 from mercurial import hg
 from mercurial import lock as lockmod
 from mercurial import merge
 from mercurial.i18n import _
 from mercurial.commands import walkopts, commitopts, commitopts2
 from mercurial.node import nullid
+from mercurial import wireproto
+from mercurial import localrepo
+from mercurial.hgweb import hgweb_mod
+from mercurial import bundle2
 
+_pack = struct.pack
+
+if gboptsmap is not None:
+    memfilectx = context.memfilectx
+elif gboptslist is not None:
+    oldmemfilectx = context.memfilectx
+    def memfilectx(repo, *args, **kwargs):
+        return oldmemfilectx(*args, **kwargs)
+else:
+    raise util.Abort('Your Mercurial is too old for this version of Evolve\n'
+                     'requires version 3.0.1 or above')
 
 
 # This extension contains the following code
 reposetup = eh.final_reposetup
 
 #####################################################################
+### experimental behavior                                         ###
+#####################################################################
+
+@eh.wrapfunction(mercurial.obsolete, 'createmarkers')
+def _createmarkers(orig, repo, relations, *args, **kwargs):
+    """register parent information at prune time"""
+    # every time this test is run, a kitten is slain.
+    # Change it as soon as possible
+    if '[,{metadata}]' in orig.__doc__:
+        for idx, rel in enumerate(relations):
+            prec = rel[0]
+            sucs = rel[1]
+            if not sucs:
+                meta = {}
+                if 2 < len(rel):
+                    meta.update(rel[2])
+                for i, p in enumerate(prec.parents(), 1):
+                    meta['p%i' % i] = p.hex()
+                relations[idx] = (prec, sucs, meta)
+    return orig(repo, relations, *args, **kwargs)
+
+def createmarkers(*args, **kwargs):
+    return obsolete.createmarkers(*args, **kwargs)
+
+class pruneobsstore(obsolete.obsstore):
+
+    def __init__(self, *args, **kwargs):
+        self.prunedchildren = {}
+        return super(pruneobsstore, self).__init__(*args, **kwargs)
+
+    def _load(self, markers):
+        markers = self._prunedetectingmarkers(markers)
+        return super(pruneobsstore, self)._load(markers)
+
+
+    def _prunedetectingmarkers(self, markers):
+        for m in markers:
+            if not m[1]: # no successors
+                meta = obsolete.decodemeta(m[3])
+                if 'p1' in meta:
+                    p1 = node.bin(meta['p1'])
+                    self.prunedchildren.setdefault(p1, set()).add(m)
+                if 'p2' in meta:
+                    p2 = node.bin(meta['p2'])
+                    self.prunedchildren.setdefault(p2, set()).add(m)
+            yield m
+
+obsolete.obsstore = pruneobsstore
+
+#####################################################################
 ### Critical fix                                                  ###
 #####################################################################
 
 # - function to travel throught the obsolescence graph
 # - function to find useful changeset to stabilize
 
-createmarkers = obsolete.createmarkers
-
 
 ### Useful alias
 
     except KeyError:
         pass  # rebase not found
 
-
 #####################################################################
 ### Old Evolve extension content                                  ###
 #####################################################################
             if path in headmf:
                 fctx = head[path]
                 flags = fctx.flags()
-                mctx = context.memfilectx(fctx.path(), fctx.data(),
-                                          islink='l' in flags,
-                                          isexec='x' in flags,
-                                          copied=copied.get(path))
+                mctx = memfilectx(repo, fctx.path(), fctx.data(),
+                                  islink='l' in flags,
+                                  isexec='x' in flags,
+                                  copied=copied.get(path))
                 return mctx
             raise IOError()
-        if commitopts.get('message') and commitopts.get('logfile'):
-            raise util.Abort(_('options --message and --logfile are mutually'
-                               ' exclusive'))
-        if commitopts.get('logfile'):
-            message= open(commitopts['logfile']).read()
-        elif commitopts.get('message'):
-            message = commitopts['message']
-        else:
+
+        message = cmdutil.logmessage(repo.ui, commitopts)
+        if not message:
             message = old.description()
 
         user = commitopts.get('user') or old.user()
      _('record the specified user in metadata'), _('USER')),
 ]
 
-if getattr(mercurial.cmdutil, 'tryimportone', None) is not None:
-    # hg 3.0 and greate
-    @eh.uisetup
-    def _installimportobsolete(ui):
-        entry = cmdutil.findcmd('import', commands.table)[1]
-        entry[1].append(('', 'obsolete', False,
-                        _('mark the old node as obsoleted by'
-                          'the created commit')))
+@eh.uisetup
+def _installimportobsolete(ui):
+    entry = cmdutil.findcmd('import', commands.table)[1]
+    entry[1].append(('', 'obsolete', False,
+                    _('mark the old node as obsoleted by'
+                      'the created commit')))
 
-    @eh.wrapfunction(mercurial.cmdutil, 'tryimportone')
-    def tryimportone(orig, ui, repo, hunk, parents, opts, *args, **kwargs):
-        extracted = patch.extract(ui, hunk)
-        expected = extracted[5]
-        oldextract = patch.extract
-        try:
-            patch.extract = lambda ui, hunk: extracted
-            ret = orig(ui, repo, hunk, parents, opts, *args, **kwargs)
-        finally:
-            patch.extract = oldextract
-        created = ret[1]
-        if opts['obsolete'] and created is not None and created != expected:
-                tr = repo.transaction('import-obs')
-                try:
-                    metadata = {'user': ui.username()}
-                    repo.obsstore.create(tr, node.bin(expected), (created,),
-                                         metadata=metadata)
-                    tr.close()
-                finally:
-                    tr.release()
-        return ret
+@eh.wrapfunction(mercurial.cmdutil, 'tryimportone')
+def tryimportone(orig, ui, repo, hunk, parents, opts, *args, **kwargs):
+    extracted = patch.extract(ui, hunk)
+    expected = extracted[5]
+    oldextract = patch.extract
+    try:
+        patch.extract = lambda ui, hunk: extracted
+        ret = orig(ui, repo, hunk, parents, opts, *args, **kwargs)
+    finally:
+        patch.extract = oldextract
+    created = ret[1]
+    if opts['obsolete'] and created is not None and created != expected:
+            tr = repo.transaction('import-obs')
+            try:
+                metadata = {'user': ui.username()}
+                repo.obsstore.create(tr, node.bin(expected), (created,),
+                                     metadata=metadata)
+                tr.close()
+            finally:
+                tr.release()
+    return ret
 
 
+def _deprecatealias(oldalias, newalias):
+    '''Deprecates an alias for a command in favour of another
+
+    Creates a new entry in the command table for the old alias. It creates a
+    wrapper that has its synopsis set to show that is has been deprecated.
+    The documentation will be replace with a pointer to the new alias.
+    If a user invokes the command a deprecation warning will be printed and
+    the command of the *new* alias will be invoked.
+
+    This function is loosely based on the extensions.wrapcommand function.
+    '''
+    aliases, entry = cmdutil.findcmd(newalias, cmdtable)
+    for alias, e in cmdtable.iteritems():
+        if e is entry:
+            break
+
+    synopsis = '(DEPRECATED)'
+    if len(entry) > 2:
+        fn, opts, _syn = entry
+    else:
+        fn, opts, = entry
+    deprecationwarning = _('%s have been deprecated in favor of %s\n' % (
+        oldalias, newalias))
+    def newfn(*args, **kwargs):
+        ui = args[0]
+        ui.warn(deprecationwarning)
+        util.checksignature(fn)(*args, **kwargs)
+    newfn.__doc__  = deprecationwarning
+    cmdwrapper = command(oldalias, opts, synopsis)
+    cmdwrapper(newfn)
+
+@eh.extsetup
+def deprecatealiases(ui):
+    _deprecatealias('gup', 'next')
+    _deprecatealias('gdown', 'previous')
+
+@command('debugrecordpruneparents', [], '')
+def cmddebugrecordpruneparents(ui, repo):
+    """add parents data to prune markers when possible
+
+    This commands search the repo for prune markers without parent information.
+    If the pruned node is locally known, a new markers with parent data is
+    created."""
+    pgop = 'reading markers'
+
+    # lock from the beginning to prevent race
+    wlock = lock = tr = None
+    try:
+        wlock = repo.wlock()
+        lock = repo.lock()
+        tr = repo.transaction('recordpruneparents')
+        unfi = repo.unfiltered()
+        nm = unfi.changelog.nodemap
+        store = repo.obsstore
+        pgtotal = len(store._all)
+        for idx, mark in enumerate(list(store._all)):
+            if not mark[1]:
+                rev = nm.get(mark[0])
+                if rev is not None:
+                    ctx = unfi[rev]
+                    meta = obsolete.decodemeta(mark[3])
+                    for i, p in enumerate(ctx.parents(), 1):
+                        meta['p%i' % i] = p.hex()
+                    before = len(store._all)
+                    store.create(tr, mark[0], mark[1], mark[2], meta)
+                    if len(store._all) - before:
+                        ui.write('created new markers for %i\n' % rev)
+            ui.progress(pgop, idx, total=pgtotal)
+        tr.close()
+        ui.progress(pgop, None)
+    finally:
+        if tr is not None:
+            tr.release()
+        lockmod.release(lock, wlock)
+
+@command('debugobsstorestat', [], '')
+def cmddebugobsstorestat(ui, repo):
+    """print statistic about obsolescence markers in the repo"""
+    store = repo.obsstore
+    unfi = repo.unfiltered()
+    nm = unfi.changelog.nodemap
+    ui.write('markers total:              %9i\n' % len(store._all))
+    sucscount = [0, 0 , 0, 0]
+    known = 0
+    parentsdata = 0
+    metatotallenght = 0
+    metakeys = {}
+    # node -> cluster mapping
+    #   a cluster is a (set(nodes), set(markers)) tuple
+    clustersmap = {}
+    # same data using parent information
+    pclustersmap= {}
+    for mark in store:
+        if mark[0] in nm:
+            known += 1
+        nbsucs = len(mark[1])
+        sucscount[min(nbsucs, 3)] += 1
+        metatotallenght += len(mark[3])
+        meta = obsolete.decodemeta(mark[3])
+        for key in meta:
+            metakeys.setdefault(key, 0)
+            metakeys[key] += 1
+        parents = [meta.get('p1'), meta.get('p2')]
+        parents = [node.bin(p) for p in parents if p is not None]
+        if parents:
+            parentsdata += 1
+        # cluster handling
+        nodes = set()
+        nodes.add(mark[0])
+        nodes.update(mark[1])
+        c = (set(nodes), set([mark]))
+
+        toproceed = set(nodes)
+        while toproceed:
+            n = toproceed.pop()
+            other = clustersmap.get(n)
+            if (other is not None
+                and other is not c):
+                other[0].update(c[0])
+                other[1].update(c[1])
+                for on in c[0]:
+                    if on in toproceed:
+                        continue
+                    clustersmap[on] = other
+                c = other
+            clustersmap[n] = c
+        # same with parent data
+        nodes.update(parents)
+        c = (set(nodes), set([mark]))
+        toproceed = set(nodes)
+        while toproceed:
+            n = toproceed.pop()
+            other = pclustersmap.get(n)
+            if (other is not None
+                and other is not c):
+                other[0].update(c[0])
+                other[1].update(c[1])
+                for on in c[0]:
+                    if on in toproceed:
+                        continue
+                    pclustersmap[on] = other
+                c = other
+            pclustersmap[n] = c
+
+    # freezing the result
+    for c in clustersmap.values():
+        fc = (frozenset(c[0]), frozenset(c[1]))
+        for n in fc[0]:
+            clustersmap[n] = fc
+    # same with parent data
+    for c in pclustersmap.values():
+        fc = (frozenset(c[0]), frozenset(c[1]))
+        for n in fc[0]:
+            pclustersmap[n] = fc
+    ui.write('    for known precursors:   %9i\n' % known)
+    ui.write('    with parents data:      %9i\n' % parentsdata)
+    # successors data
+    ui.write('markers with no successors: %9i\n' % sucscount[0])
+    ui.write('              1 successors: %9i\n' % sucscount[1])
+    ui.write('              2 successors: %9i\n' % sucscount[2])
+    ui.write('    more than 2 successors: %9i\n' % sucscount[3])
+    # meta data info
+    ui.write('average meta length:        %9i\n'
+             % (metatotallenght/len(store._all)))
+    ui.write('    available  keys:\n')
+    for key in sorted(metakeys):
+        ui.write('    %15s:        %9i\n' % (key, metakeys[key]))
+
+    allclusters = list(set(clustersmap.values()))
+    allclusters.sort(key=lambda x: len(x[1]))
+    ui.write('disconnected clusters:      %9i\n' % len(allclusters))
+
+    ui.write('        any known node:     %9i\n'
+             % len([c for c in allclusters
+                    if [n for n in c[0] if nm.get(n) is not None]]))
+    if allclusters:
+        nbcluster = len(allclusters)
+        ui.write('        smallest length:    %9i\n' % len(allclusters[0][1]))
+        ui.write('        longer length:      %9i\n' % len(allclusters[-1][1]))
+        median = len(allclusters[nbcluster//2][1])
+        ui.write('        median length:      %9i\n' % median)
+        mean = sum(len(x[1]) for x in allclusters) // nbcluster
+        ui.write('        mean length:        %9i\n' % mean)
+    allpclusters = list(set(pclustersmap.values()))
+    allpclusters.sort(key=lambda x: len(x[1]))
+    ui.write('    using parents data:     %9i\n' % len(allpclusters))
+    ui.write('        any known node:     %9i\n'
+             % len([c for c in allclusters
+                    if [n for n in c[0] if nm.get(n) is not None]]))
+    if allpclusters:
+        nbcluster = len(allpclusters)
+        ui.write('        smallest length:    %9i\n' % len(allpclusters[0][1]))
+        ui.write('        longer length:      %9i\n' % len(allpclusters[-1][1]))
+        median = len(allpclusters[nbcluster//2][1])
+        ui.write('        median length:      %9i\n' % median)
+        mean = sum(len(x[1]) for x in allpclusters) // nbcluster
+        ui.write('        mean length:        %9i\n' % mean)
+
 @command('^evolve|stabilize|solve',
     [('n', 'dry-run', False,
         'do not perform actions, just print what would be done'),
                         if path in bumped:
                             fctx = bumped[path]
                             flags = fctx.flags()
-                            mctx = context.memfilectx(fctx.path(), fctx.data(),
-                                                      islink='l' in flags,
-                                                      isexec='x' in flags,
-                                                      copied=copied.get(path))
+                            mctx = memfilectx(repo, fctx.path(), fctx.data(),
+                                              islink='l' in flags,
+                                              isexec='x' in flags,
+                                              copied=copied.get(path))
                             return mctx
                         raise IOError()
                     text = 'bumped update to %s:\n\n' % prec
 
 shorttemplate = '[{rev}] {desc|firstline}\n'
 
-@command('^gdown|previous',
+@command('^previous',
          [],
          '')
 def cmdprevious(ui, repo):
         ui.warn(_('multiple parents, explicitly update to one\n'))
         return 1
 
-@command('^gup|next',
+@command('^next',
          [],
          '')
 def cmdnext(ui, repo):
             raise IOError()
         fctx = ctx[path]
         flags = fctx.flags()
-        mctx = context.memfilectx(fctx.path(), fctx.data(),
-                                  islink='l' in flags,
-                                  isexec='x' in flags,
-                                  copied=copied.get(path))
+        mctx = memfilectx(repo, fctx.path(), fctx.data(),
+                          islink='l' in flags,
+                          isexec='x' in flags,
+                          copied=copied.get(path))
         return mctx
 
     new = context.memctx(repo,
     entry[1].append(('O', 'old-obsolete', False,
                      _("make graft obsoletes its source")))
 
+#####################################################################
+### Obsolescence marker exchange experimenation                   ###
+#####################################################################
+
+@command('debugobsoleterelevant',
+         [],
+         'REVSET')
+def debugobsoleterelevant(ui, repo, *revsets):
+    """print allobsolescence marker relevant to a set of revision"""
+    nodes = [ctx.node() for ctx in repo.set('%lr', revsets)]
+    markers = repo.obsstore.relevantmarkers(nodes)
+    for rawmarker in sorted(markers):
+        marker = obsolete.marker(repo, rawmarker)
+        cmdutil.showmarker(ui, marker)
+
+@eh.addattr(obsolete.obsstore, 'relevantmarkers')
+def relevantmarkers(self, nodes):
+    """return a set of all obsolescence marker relevant to a set of node.
+
+    "relevant" to a set of node mean:
+
+    - marker that use this changeset as successors
+    - prune marker of direct children on this changeset.
+    - recursive application of the two rules on precursors of these markers
+
+    It  a set so you cannot rely on order"""
+    seennodes = set(nodes)
+    seenmarkers = set()
+    pendingnodes = set(nodes)
+    precursorsmarkers = self.precursors
+    prunedchildren = self.prunedchildren
+    while pendingnodes:
+        direct = set()
+        for current in pendingnodes:
+            direct.update(precursorsmarkers.get(current, ()))
+            direct.update(prunedchildren.get(current, ()))
+        direct -= seenmarkers
+        pendingnodes = set([m[0] for m in direct])
+        seenmarkers |= direct
+        pendingnodes -= seennodes
+        seennodes |= pendingnodes
+    return seenmarkers
+
+
+_pushkeyescape = getattr(obsolete, '_pushkeyescape', None)
+if _pushkeyescape is None:
+    _maxpayload = 5300
+    def _pushkeyescape(markers):
+        """encode markers into a dict suitable for pushkey exchange
+
+        - binary data are base86 encoded
+        - splited in chunk less than 5300 bytes"""
+        parts = []
+        currentlen = _maxpayload * 2  # ensure we create a new part
+        for marker in markers:
+            nextdata = obsolete._encodeonemarker(marker)
+            if (len(nextdata) + currentlen > _maxpayload):
+                currentpart = []
+                currentlen = 0
+                parts.append(currentpart)
+            currentpart.append(nextdata)
+            currentlen += len(nextdata)
+        keys = {}
+        for idx, part in enumerate(reversed(parts)):
+            data = ''.join([_pack('>B', 0)] + part)
+            keys['dump%i' % idx] = base85.b85encode(data)
+        return keys
+
+def _encodemarkersstream(fp, markers):
+    fp.write(_pack('>B', 0))
+    for mark in markers:
+        fp.write(obsolete._encodeonemarker(mark))
+
+class pushobsmarkerStringIO(StringIO):
+    """hacky string io for progress"""
+
+    @util.propertycache
+    def length(self):
+        return len(self.getvalue())
+
+    def read(self, size):
+        self.ui.progress('OBSEXC', self.tell(), unit="bytes",
+                         total=self.length)
+        return StringIO.read(self, size)
+
+    def __iter__(self):
+        d = self.read(4096)
+        while d:
+            yield d
+            d = self.read(4096)
+
+
+
+@eh.wrapfunction(exchange, '_pushobsolete')
+def _pushobsolete(orig, pushop):
+    """utility function to push obsolete markers to a remote"""
+    pushop.ui.debug('try to push obsolete markers to remote\n')
+    repo = pushop.repo
+    remote = pushop.remote
+    unfi = repo.unfiltered()
+    cl = unfi.changelog
+    if (obsolete._enabled and repo.obsstore and
+        'obsolete' in remote.listkeys('namespaces')):
+        repo.ui.status("OBSEXC: computing relevant nodes\n")
+        revs = unfi.revs('::%ln', pushop.commonheads)
+        common = []
+        if remote.capable('_evoext_obshash_0'):
+            repo.ui.status("OBSEXC: looking for common markers in %i nodes\n"
+                           % len(revs))
+            common = findcommonobsmarkers(pushop.ui, repo, remote, revs)
+            revs = list(unfi.revs('%ld - (::%ln)', revs, common))
+        nodes = [cl.node(r) for r in revs]
+        if nodes:
+            repo.ui.status("OBSEXC: computing markers relevant to %i nodes\n"
+                           % len(nodes))
+            markers = repo.obsstore.relevantmarkers(nodes)
+        else:
+            repo.ui.status("OBSEXC: markers already in sync\n")
+            markers = []
+        if not markers:
+            repo.ui.status("OBSEXC: no marker to push\n")
+        elif remote.capable('_evoext_b2x_obsmarkers_0'):
+            obsdata = pushobsmarkerStringIO()
+            _encodemarkersstream(obsdata, markers)
+            obsdata.seek(0)
+            obsdata.ui = repo.ui
+            repo.ui.status("OBSEXC: pushing %i markers (%i bytes)\n"
+                           % (len(markers), len(obsdata.getvalue())))
+            bundler = bundle2.bundle20(pushop.ui, {})
+            capsblob = bundle2.encodecaps(pushop.repo.bundle2caps)
+            bundler.addpart(bundle2.bundlepart('b2x:replycaps', data=capsblob))
+            cgpart = bundle2.bundlepart('EVOLVE:B2X:OBSMARKERV1', data=obsdata)
+            bundler.addpart(cgpart)
+            stream = util.chunkbuffer(bundler.getchunks())
+            try:
+                reply = pushop.remote.unbundle(stream, ['force'], 'push')
+            except bundle2.UnknownPartError, exc:
+                raise util.Abort('missing support for %s' % exc)
+            try:
+                op = bundle2.processbundle(pushop.repo, reply)
+            except bundle2.UnknownPartError, exc:
+                raise util.Abort('missing support for %s' % exc)
+            repo.ui.progress('OBSEXC', None)
+        elif remote.capable('_evoext_pushobsmarkers_0'):
+            obsdata = pushobsmarkerStringIO()
+            _encodemarkersstream(obsdata, markers)
+            obsdata.seek(0)
+            obsdata.ui = repo.ui
+            repo.ui.status("OBSEXC: pushing %i markers (%i bytes)\n"
+                           % (len(markers), len(obsdata.getvalue())))
+            remote.evoext_pushobsmarkers_0(obsdata)
+            repo.ui.progress('OBSEXC', None)
+        else:
+            rslts = []
+            remotedata = _pushkeyescape(markers).items()
+            totalbytes = sum(len(d) for k,d in remotedata)
+            sentbytes = 0
+            repo.ui.status("OBSEXC: pushing %i markers in %i pushkey payload (%i bytes)\n"
+                            % (len(markers), len(remotedata), totalbytes))
+            for key, data in remotedata:
+                repo.ui.progress('OBSEXC', sentbytes, item=key, unit="bytes",
+                                 total=totalbytes)
+                rslts.append(remote.pushkey('obsolete', key, '', data))
+                sentbytes += len(data)
+                repo.ui.progress('OBSEXC', sentbytes, item=key, unit="bytes",
+                                 total=totalbytes)
+            repo.ui.progress('OBSEXC', None)
+            if [r for r in rslts if not r]:
+                msg = _('failed to push some obsolete markers!\n')
+                repo.ui.warn(msg)
+        repo.ui.status("OBSEXC: DONE\n")
+
+
+@eh.addattr(wireproto.wirepeer, 'evoext_pushobsmarkers_0')
+def client_pushobsmarkers(self, obsfile):
+    """wireprotocol peer method"""
+    self.requirecap('_evoext_pushobsmarkers_0',
+                    _('push obsolete markers faster'))
+    ret, output = self._callpush('evoext_pushobsmarkers_0', obsfile)
+    for l in output.splitlines(True):
+        self.ui.status(_('remote: '), l)
+    return ret
+
+@eh.addattr(httppeer.httppeer, 'evoext_pushobsmarkers_0')
+def httpclient_pushobsmarkers(self, obsfile):
+    """httpprotocol peer method
+    (Cannot simply use _callpush as http is doing some special handling)"""
+    self.requirecap('_evoext_pushobsmarkers_0',
+                    _('push obsolete markers faster'))
+    ret, output = self._call('evoext_pushobsmarkers_0', data=obsfile)
+    for l in output.splitlines(True):
+        if l.strip():
+            self.ui.status(_('remote: '), l)
+    return ret
+
+
+def srv_pushobsmarkers(repo, proto):
+    """wireprotocol command"""
+    fp = StringIO()
+    proto.redirect()
+    proto.getfile(fp)
+    data = fp.getvalue()
+    fp.close()
+    lock = repo.lock()
+    try:
+        tr = repo.transaction('pushkey: obsolete markers')
+        try:
+            repo.obsstore.mergemarkers(tr, data)
+            tr.close()
+        finally:
+            tr.release()
+    finally:
+        lock.release()
+    repo.hook('evolve_pushobsmarkers')
+    return wireproto.pushres(0)
+
+@bundle2.parthandler('evolve:b2x:obsmarkerv1')
+def handleobsmarkerv1(op, inpart):
+    """add a stream of obsmarker to the repo"""
+    tr = op.gettransaction()
+    advparams = dict(inpart.advisoryparams)
+    length = advparams.get('totalbytes')
+    if length is None:
+        obsdata = inpart.read()
+    else:
+        length = int(length)
+        data = StringIO()
+        current = 0
+        op.ui.progress('OBSEXC', current, unit="bytes", total=length)
+        while current < length:
+            readsize = min(length-current, 4096)
+            data.write(inpart.read(readsize))
+            current += readsize
+            op.ui.progress('OBSEXC', current, unit="bytes", total=length)
+        op.ui.progress('OBSEXC', None)
+        obsdata = data.getvalue()
+    totalsize = len(obsdata)
+    old = len(op.repo.obsstore._all)
+    op.repo.obsstore.mergemarkers(tr, obsdata)
+    new = len(op.repo.obsstore._all) - old
+    op.records.add('evo_obsmarkers', {'new': new, 'bytes': totalsize})
+    tr.hookargs['evolve_new_obsmarkers'] = str(new)
+
+def _buildpullobsmerkersboundaries(pullop):
+    """small funtion returning the argument for pull markers call
+    may to contains 'heads' and 'common'. skip the key for None.
+
+    Its a separed functio to play around with strategy for that."""
+    repo = pullop.repo
+    cl = pullop.repo.changelog
+    remote = pullop.remote
+    unfi = repo.unfiltered()
+    revs = unfi.revs('::%ln', pullop.pulledsubset)
+    common = [nullid]
+    if remote.capable('_evoext_obshash_0'):
+        repo.ui.status("OBSEXC: looking for common markers in %i nodes\n"
+                       % len(revs))
+        common = findcommonobsmarkers(repo.ui, repo, remote, revs)
+    return {'heads': pullop.pulledsubset, 'common': common}
+
+@eh.uisetup
+def addgetbundleargs(self):
+    if gboptsmap is not None:
+        gboptsmap['evo_obsmarker'] = 'plain'
+        gboptsmap['evo_obscommon'] = 'plain'
+        gboptsmap['evo_obsheads'] = 'plain'
+    else:
+        gboptslist.append('evo_obsheads')
+        gboptslist.append('evo_obscommon')
+        gboptslist.append('evo_obsmarker')
+
+
+
+@eh.wrapfunction(exchange, '_getbundleextrapart')
+def _getbundleextrapart(orig, bundler, repo, source, **kwargs):
+    if int(kwargs.pop('evo_obsmarker', False)):
+        common = kwargs.pop('evo_obscommon')
+        common = wireproto.decodelist(common)
+        heads = kwargs.pop('evo_obsheads')
+        heads = wireproto.decodelist(heads)
+        obsdata = _getobsmarkersstream(repo, common=common, heads=heads)
+        if len(obsdata.getvalue()) > 5:
+            advparams = [('totalbytes', str(len(obsdata.getvalue())))]
+            obspart = bundle2.bundlepart('EVOLVE:B2X:OBSMARKERV1',
+                                         advisoryparams=advparams,
+                                         data=obsdata)
+            bundler.addpart(obspart)
+    orig(bundler, repo, source)
+
+@eh.wrapfunction(exchange, '_pullobsolete')
+def _pullobsolete(orig, pullop):
+    if not obsolete._enabled:
+        return None
+    b2xpull = pullop.remote.capable('_evoext_b2x_obsmarkers_0')
+    wirepull = pullop.remote.capable('_evoext_pullobsmarkers_0')
+    if not (b2xpull or wirepull):
+        return orig(pullop)
+    if 'obsolete' not in pullop.remote.listkeys('namespaces'):
+        return None # remote opted out of obsolescence marker exchange
+    tr = None
+    ui = pullop.repo.ui
+    ui.status("OBSEXC: pull obsolescence markers\n")
+    boundaries = _buildpullobsmerkersboundaries(pullop)
+    new = 0
+
+    if b2xpull:
+        kwargs = {'bundlecaps': set(['HG2X'])}
+        capsblob = bundle2.encodecaps(pullop.repo.bundle2caps)
+        kwargs['bundlecaps'].add('bundle2=' + urllib.quote(capsblob))
+        kwargs['heads'] = [nullid]
+        kwargs['common'] = [nullid]
+        kwargs['evo_obsmarker'] = '1'
+        kwargs['evo_obscommon'] = wireproto.encodelist(boundaries['common'])
+        kwargs['evo_obsheads'] = wireproto.encodelist(boundaries['heads'])
+        bundle = pullop.remote.getbundle('pull', **kwargs)
+        try:
+            op = bundle2.processbundle(pullop.repo, bundle, pullop.gettransaction)
+        except bundle2.UnknownPartError, exc:
+            raise util.Abort('missing support for %s' % exc)
+        bytes = new = 0
+        for entry in op.records['evo_obsmarkers']:
+            bytes += entry.get('bytes', 0)
+            new += entry.get('new', 0)
+        if 5 < bytes:
+            ui.status("OBSEXC: merging obsolescence markers (%i bytes)\n"
+                      % bytes)
+            ui.status("OBSEXC: %i markers added\n" % new)
+            tr = op.gettransaction()
+        else:
+            ui.status("OBSEXC: no unknown remote markers\n")
+        ui.status("OBSEXC: DONE\n")
+    elif wirepull:
+        obsdata = pullop.remote.evoext_pullobsmarkers_0(**boundaries)
+        obsdata = obsdata.read()
+        if len(obsdata) > 5:
+            ui.status("OBSEXC: merging obsolescence markers (%i bytes)\n"
+                           % len(obsdata))
+            tr = pullop.gettransaction()
+            old = len(pullop.repo.obsstore._all)
+            pullop.repo.obsstore.mergemarkers(tr, obsdata)
+            new = len(pullop.repo.obsstore._all) - old
+            ui.status("OBSEXC: %i markers added\n" % new)
+        else:
+            ui.status("OBSEXC: no unknown remote markers\n")
+        ui.status("OBSEXC: DONE\n")
+    if new:
+        pullop.repo.invalidatevolatilesets()
+    return tr
+
+def _getobsmarkersstream(repo, heads=None, common=None):
+    revset = ''
+    args = []
+    repo = repo.unfiltered()
+    if heads is None:
+        revset = 'all()'
+    elif heads:
+        revset += "(::%ln)"
+        args.append(heads)
+    else:
+        assert False, 'pulling no heads?'
+    if common:
+        revset += ' - (::%ln)'
+        args.append(common)
+    nodes = [c.node() for c in repo.set(revset, *args)]
+    markers = repo.obsstore.relevantmarkers(nodes)
+    obsdata = StringIO()
+    _encodemarkersstream(obsdata, markers)
+    obsdata.seek(0)
+    return obsdata
+
+@eh.addattr(wireproto.wirepeer, 'evoext_pullobsmarkers_0')
+def client_pullobsmarkers(self, heads=None, common=None):
+    self.requirecap('_evoext_pullobsmarkers_0', _('look up remote obsmarkers'))
+    opts = {}
+    if heads is not None:
+        opts['heads'] = wireproto.encodelist(heads)
+    if common is not None:
+        opts['common'] = wireproto.encodelist(common)
+    if util.safehasattr(self, '_callcompressable'):
+        f = self._callcompressable("evoext_pullobsmarkers_0", **opts)
+    else:
+        f = self._callstream("evoext_pullobsmarkers_0", **opts)
+        f = self._decompress(f)
+    length = int(f.read(20))
+    chunk = 4096
+    current = 0
+    data = StringIO()
+    ui = self.ui
+    ui.progress('OBSEXC', current, unit="bytes", total=length)
+    while current < length:
+        readsize = min(length-current, chunk)
+        data.write(f.read(readsize))
+        current += readsize
+        ui.progress('OBSEXC', current, unit="bytes", total=length)
+    ui.progress('OBSEXC', None)
+    data.seek(0)
+    return data
+
+@eh.addattr(localrepo.localpeer, 'evoext_pullobsmarkers_0')
+def local_pullobsmarkers(self, heads=None, common=None):
+    return _getobsmarkersstream(self._repo, heads=heads, common=common)
+
+def srv_pullobsmarkers(repo, proto, others):
+    opts = wireproto.options('', ['heads', 'common'], others)
+    for k, v in opts.iteritems():
+        if k in ('heads', 'common'):
+            opts[k] = wireproto.decodelist(v)
+    obsdata = _getobsmarkersstream(repo, **opts)
+    finaldata = StringIO()
+    obsdata = obsdata.getvalue()
+    finaldata.write('%20i' % len(obsdata))
+    finaldata.write(obsdata)
+    finaldata.seek(0)
+    return wireproto.streamres(proto.groupchunks(finaldata))
+
+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)))
+
+
+### Set discovery START
+
+import random
+from mercurial import dagutil
+from mercurial import setdiscovery
+
+def _obshash(repo, nodes):
+    hashs = _obsrelsethashtree(repo)
+    nm = repo.changelog.nodemap
+    return  [hashs[nm.get(n)][1] for n in nodes]
+
+def srv_obshash(repo, proto, nodes):
+    return wireproto.encodelist(_obshash(repo, wireproto.decodelist(nodes)))
+
+@eh.addattr(localrepo.localpeer, 'evoext_obshash')
+def local_obshash(peer, nodes):
+    return _obshash(peer._repo, nodes)
+
+@eh.addattr(wireproto.wirepeer, 'evoext_obshash')
+def peer_obshash(self, nodes):
+    d = self._call("evoext_obshash", nodes=wireproto.encodelist(nodes))
+    try:
+        return wireproto.decodelist(d)
+    except ValueError:
+        self._abort(error.ResponseError(_("unexpected response:"), d))
+
+def findcommonobsmarkers(ui, local, remote, probeset,
+                    initialsamplesize=100,
+                    fullsamplesize=200):
+    # from discovery
+    roundtrips = 0
+    cl = local.changelog
+    dag = dagutil.revlogdag(cl)
+    localhash = _obsrelsethashtree(local)
+    missing = set()
+    common = set()
+    undecided = set(probeset)
+    _takefullsample = setdiscovery._takefullsample
+
+    while undecided:
+
+        ui.note(_("sampling from both directions\n"))
+        sample = _takefullsample(dag, undecided, size=fullsamplesize)
+
+        roundtrips += 1
+        ui.debug("query %i; still undecided: %i, sample size is: %i\n"
+                 % (roundtrips, len(undecided), len(sample)))
+        # indices between sample and externalized version must match
+        sample = list(sample)
+        remotehash = remote.evoext_obshash(dag.externalizeall(sample))
+
+        yesno = [localhash[ix][1] == remotehash[si]
+                 for si, ix in enumerate(sample)]
+
+        commoninsample = set(n for i, n in enumerate(sample) if yesno[i])
+        common.update(dag.ancestorset(commoninsample, common))
+
+        missinginsample = [n for i, n in enumerate(sample) if not yesno[i]]
+        missing.update(dag.descendantset(missinginsample, missing))
+
+        undecided.difference_update(missing)
+        undecided.difference_update(common)
+
+
+    result = dag.headsetofconnecteds(common)
+    ui.debug("%d total queries\n" % roundtrips)
+
+    if not result:
+        return set([nullid])
+    return dag.externalizeall(result)
+
+@eh.wrapfunction(wireproto, 'capabilities')
+def capabilities(orig, repo, proto):
+    """wrapper to advertise new capability"""
+    caps = orig(repo, proto)
+    if obsolete._enabled:
+        caps += ' _evoext_pushobsmarkers_0'
+        caps += ' _evoext_pullobsmarkers_0'
+        caps += ' _evoext_obshash_0'
+        caps += ' _evoext_b2x_obsmarkers_0'
+    return caps
+
+
+@eh.extsetup
+def _installwireprotocol(ui):
+    localrepo.moderncaps.add('_evoext_pullobsmarkers_0')
+    localrepo.moderncaps.add('_evoext_b2x_obsmarkers_0')
+    hgweb_mod.perms['evoext_pushobsmarkers_0'] = 'push'
+    hgweb_mod.perms['evoext_pullobsmarkers_0'] = 'pull'
+    hgweb_mod.perms['evoext_obshash'] = 'pull'
+    wireproto.commands['evoext_pushobsmarkers_0'] = (srv_pushobsmarkers, '')
+    wireproto.commands['evoext_pullobsmarkers_0'] = (srv_pullobsmarkers, '*')
+    # wrap command content
+    oldcap, args = wireproto.commands['capabilities']
+    def newcap(repo, proto):
+        return capabilities(oldcap, repo, proto)
+    wireproto.commands['capabilities'] = (newcap, args)
+    wireproto.commands['evoext_obshash'] = (srv_obshash, 'nodes')

File hgext/simple4server.py

 For client side usages it is recommended to use the evolve extension for
 improved user interface.'''
 
+testedwith = '3.0.1'
+buglink = 'https://bitbucket.org/marmoute/mutable-history/issues'
+
 import mercurial.obsolete
 mercurial.obsolete._enabled = True
+
+import struct
+from mercurial import util
+from mercurial import wireproto
+from mercurial import extensions
+from mercurial import obsolete
+from cStringIO import StringIO
+from mercurial import node
+from mercurial.hgweb import hgweb_mod
+from mercurial import bundle2
+from mercurial import localrepo
+from mercurial import exchange
+_pack = struct.pack
+
+gboptslist = gboptsmap = None
+try:
+    from mercurial import obsolete
+    if not obsolete._enabled:
+        obsolete._enabled = True
+    from mercurial import wireproto
+    gboptslist = getattr(wireproto, 'gboptslist', None)
+    gboptsmap = getattr(wireproto, 'gboptsmap', None)
+except (ImportError, AttributeError):
+    raise util.Abort('Your Mercurial is too old for this version of Evolve\n'
+                     'requires version 3.0.1 or above')
+
+# Start of simple4server specific content
+
+from mercurial import pushkey
+
+# specific content also include the wrapping int extsetup
+def _nslist(orig, repo):
+    rep = orig(repo)
+    if not repo.ui.configbool('__temporary__', 'advertiseobsolete', True):
+        rep.pop('obsolete')
+    return rep
+
+# End of simple4server specific content
+
+
+
+# from evolve extension: 1a23c7c52a43
+def srv_pushobsmarkers(repo, proto):
+    """That receives a stream of markers and apply then to the repo"""
+    fp = StringIO()
+    proto.redirect()
+    proto.getfile(fp)
+    data = fp.getvalue()
+    fp.close()
+    lock = repo.lock()
+    try:
+        tr = repo.transaction('pushkey: obsolete markers')
+        try:
+            repo.obsstore.mergemarkers(tr, data)
+            tr.close()
+        finally:
+            tr.release()
+    finally:
+        lock.release()
+    repo.hook('evolve_pushobsmarkers')
+    return wireproto.pushres(0)
+
+# from mercurial.obsolete: 19e9478c1a22
+def _encodemarkersstream(fp, markers):
+    """write a binary version of a set of markers
+
+    Includes the initial version number"""
+    fp.write(_pack('>B', 0))
+    for mark in markers:
+        fp.write(obsolete._encodeonemarker(mark))
+
+# from evolve extension: 1a23c7c52a43
+def _getobsmarkersstream(repo, heads=None, common=None):
+    """Get a binary stream for all markers relevant to `::<heads> - ::<common>`
+    """
+    revset = ''
+    args = []
+    repo = repo.unfiltered()
+    if heads is None:
+        revset = 'all()'
+    elif heads:
+        revset += "(::%ln)"
+        args.append(heads)
+    else:
+        assert False, 'pulling no heads?'
+    if common:
+        revset += ' - (::%ln)'
+        args.append(common)
+    nodes = [c.node() for c in repo.set(revset, *args)]
+    markers = repo.obsstore.relevantmarkers(nodes)
+    obsdata = StringIO()
+    _encodemarkersstream(obsdata, markers)
+    obsdata.seek(0)
+    return obsdata
+
+# from evolve extension: 1a23c7c52a43
+class pruneobsstore(obsolete.obsstore):
+    """And extended obsstore class that read parent information from v1 format
+
+    Evolve extension adds parent information in prune marker. We use it to make
+    markers relevant to pushed changeset."""
+
+    def __init__(self, *args, **kwargs):
+        self.prunedchildren = {}
+        return super(pruneobsstore, self).__init__(*args, **kwargs)
+
+    def _load(self, markers):
+        markers = self._prunedetectingmarkers(markers)
+        return super(pruneobsstore, self)._load(markers)
+
+
+    def _prunedetectingmarkers(self, markers):
+        for m in markers:
+            if not m[1]: # no successors
+                meta = obsolete.decodemeta(m[3])
+                if 'p1' in meta:
+                    p1 = node.bin(meta['p1'])
+                    self.prunedchildren.setdefault(p1, set()).add(m)
+                if 'p2' in meta:
+                    p2 = node.bin(meta['p2'])
+                    self.prunedchildren.setdefault(p2, set()).add(m)
+            yield m
+
+# from evolve extension: 1a23c7c52a43
+def relevantmarkers(self, nodes):
+    """return a set of all obsolescence marker relevant to a set of node.
+
+    "relevant" to a set of node mean:
+
+    - marker that use this changeset as successors
+    - prune marker of direct children on this changeset.
+    - recursive application of the two rules on precursors of these markers
+
+    It is a set so you cannot rely on order"""
+    seennodes = set(nodes)
+    seenmarkers = set()
+    pendingnodes = set(nodes)
+    precursorsmarkers = self.precursors
+    prunedchildren = self.prunedchildren
+    while pendingnodes:
+        direct = set()
+        for current in pendingnodes:
+            direct.update(precursorsmarkers.get(current, ()))
+            direct.update(prunedchildren.get(current, ()))
+        direct -= seenmarkers
+        pendingnodes = set([m[0] for m in direct])
+        seenmarkers |= direct
+        pendingnodes -= seennodes
+        seennodes |= pendingnodes
+    return seenmarkers
+
+# from evolve extension: cf35f38d6a10
+def srv_pullobsmarkers(repo, proto, others):
+    """serves a binary stream of markers.
+
+    Serves relevant to changeset between heads and common. The stream is prefix
+    by a -string- representation of an integer. This integer is the size of the
+    stream."""
+    opts = wireproto.options('', ['heads', 'common'], others)
+    for k, v in opts.iteritems():
+        if k in ('heads', 'common'):
+            opts[k] = wireproto.decodelist(v)
+    obsdata = _getobsmarkersstream(repo, **opts)
+    finaldata = StringIO()
+    obsdata = obsdata.getvalue()
+    finaldata.write('%20i' % len(obsdata))
+    finaldata.write(obsdata)
+    finaldata.seek(0)
+    return wireproto.streamres(proto.groupchunks(finaldata))
+
+
+# from evolve extension: 1a23c7c52a43
+def _obsrelsethashtree(repo):
+    """Build an obshash for every node in a repo
+
+    return a [(node), (obshash)] list. in revision order."""
+    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 = node.nullid
+            else:
+                p = cache[p][1]
+            if p != node.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(), node.nullid))
+    return cache
+
+# from evolve extension: 1a23c7c52a43
+def _obshash(repo, nodes):
+    """hash of binary version of relevant markers + obsparent
+
+    (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]
+
+# from evolve extension: 1a23c7c52a43
+def srv_obshash(repo, proto, nodes):
+    """give the obshash of a a set of node
+
+    Used for markes discovery"""
+    return wireproto.encodelist(_obshash(repo, wireproto.decodelist(nodes)))
+
+# from evolve extension: 1a23c7c52a43
+def capabilities(orig, repo, proto):
+    """wrapper to advertise new capability"""
+    caps = orig(repo, proto)
+    advertise = repo.ui.configbool('__temporary__', 'advertiseobsolete', True)
+    if obsolete._enabled and advertise:
+        caps += ' _evoext_pushobsmarkers_0'
+        caps += ' _evoext_pullobsmarkers_0'
+        caps += ' _evoext_obshash_0'
+        caps += ' _evoext_b2x_obsmarkers_0'
+    return caps
+
+
+# from evolve extension: 10867a8e27c6
+# heavily modified
+def extsetup(ui):
+    localrepo.moderncaps.add('_evoext_b2x_obsmarkers_0')
+    if gboptsmap is not None:
+        gboptsmap['evo_obsmarker'] = 'plain'
+        gboptsmap['evo_obscommon'] = 'plain'
+        gboptsmap['evo_obsheads'] = 'plain'
+    else:
+        gboptslist.append('evo_obsheads')
+        gboptslist.append('evo_obscommon')
+        gboptslist.append('evo_obsmarker')
+    obsolete.obsstore = pruneobsstore
+    obsolete.obsstore.relevantmarkers = relevantmarkers
+    hgweb_mod.perms['evoext_pushobsmarkers_0'] = 'push'
+    hgweb_mod.perms['evoext_pullobsmarkers_0'] = 'pull'
+    hgweb_mod.perms['evoext_obshash'] = 'pull'
+    wireproto.commands['evoext_pushobsmarkers_0'] = (srv_pushobsmarkers, '')
+    wireproto.commands['evoext_pullobsmarkers_0'] = (srv_pullobsmarkers, '*')
+    # wrap module content
+    extensions.wrapfunction(exchange, '_getbundleextrapart', _getbundleextrapart)
+    extensions.wrapfunction(wireproto, 'capabilities', capabilities)
+    # wrap command content
+    oldcap, args = wireproto.commands['capabilities']
+    def newcap(repo, proto):
+        return capabilities(oldcap, repo, proto)
+    wireproto.commands['capabilities'] = (newcap, args)
+    wireproto.commands['evoext_obshash'] = (srv_obshash, 'nodes')
+    # specific simple4server content
+    extensions.wrapfunction(pushkey, '_nslist', _nslist)
+    pushkey._namespaces['namespaces'] = (lambda *x: False, pushkey._nslist)
+
+
+#from evolve extension
+@bundle2.parthandler('evolve:b2x:obsmarkerv1')
+def handleobsmarkerv1(op, inpart):
+    """add a stream of obsmarker to the repo"""
+    tr = op.gettransaction()
+    advparams = dict(inpart.advisoryparams)
+    length = advparams.get('totalbytes')
+    if length is None:
+        obsdata = inpart.read()
+    else:
+        length = int(length)
+        data = StringIO()
+        current = 0
+        op.ui.progress('OBSEXC', current, unit="bytes", total=length)
+        while current < length:
+            readsize = min(length-current, 4096)
+            data.write(inpart.read(readsize))
+            current += readsize
+            op.ui.progress('OBSEXC', current, unit="bytes", total=length)
+        op.ui.progress('OBSEXC', None)
+        obsdata = data.getvalue()
+    totalsize = len(obsdata)
+    old = len(op.repo.obsstore._all)
+    op.repo.obsstore.mergemarkers(tr, obsdata)
+    new = len(op.repo.obsstore._all) - old
+    op.records.add('evo_obsmarkers', {'new': new, 'bytes': totalsize})
+    tr.hookargs['evolve_new_obsmarkers'] = str(new)
+
+#from evolve extension
+def _getbundleextrapart(orig, bundler, repo, source, **kwargs):
+    if int(kwargs.pop('evo_obsmarker', False)):
+        common = kwargs.pop('evo_obscommon')
+        common = wireproto.decodelist(common)
+        heads = kwargs.pop('evo_obsheads')
+        heads = wireproto.decodelist(heads)
+        obsdata = _getobsmarkersstream(repo, common=common, heads=heads)
+        if len(obsdata.getvalue()) > 5:
+            advparams = [('totalbytes', str(len(obsdata.getvalue())))]
+            obspart = bundle2.bundlepart('EVOLVE:B2X:OBSMARKERV1',
+                                         advisoryparams=advparams,
+                                         data=obsdata)
+            bundler.addpart(obspart)
+    orig(bundler, repo, source)

File tests/_exc-util.sh

+#!/bin/sh
+
+cat >> $HGRCPATH <<EOF
+[web]
+push_ssl = false
+allow_push = *
+[ui]
+logtemplate ="{node|short} ({phase}): {desc}\n"
+[phases]
+publish=False
+[extensions]
+hgext.strip=
+hgext.rebase=
+EOF
+echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH
+
+mkcommit() {
+   echo "$1" > "$1"
+   hg add "$1"
+   hg ci -m "$1"
+}
+getid() {
+   hg id --hidden --debug -ir "$1"
+}
+
+setuprepos() {
+    echo creating test repo for test case $1
+    mkdir $1
+    cd $1
+    echo - pulldest
+    hg init pushdest
+    cd pushdest
+    mkcommit O
+    hg phase --public .
+    cd ..
+    echo - main
+    hg clone -q pushdest main
+    echo - pushdest
+    hg clone -q main pulldest
+    echo 'cd into `main` and proceed with env setup'
+}
+
+dotest() {
+# dotest TESTNAME [TARGETNODE]
+
+    testcase=$1
+    shift
+    target="$1"
+    if [ $# -gt 0 ]; then
+        shift
+    fi
+    targetnode=""
+    desccall=""
+    cd $testcase
+    echo "## Running testcase $testcase"
+    if [ -n "$target" ]; then
+        desccall="desc("\'"$target"\'")"
+        targetnode="`hg -R main id -qr \"$desccall\"`"
+        echo "# testing echange of \"$target\" ($targetnode)"
+    fi
+    echo "## initial state"
+    echo "# obstore: main"
+    hg -R main     debugobsolete | sort
+    echo "# obstore: pushdest"
+    hg -R pushdest debugobsolete | sort
+    echo "# obstore: pulldest"
+    hg -R pulldest debugobsolete | sort
+
+    if [ -n "$target" ]; then
+        echo "## pushing \"$target\"" from main to pushdest
+        hg -R main push -r "$desccall" $@ pushdest
+    else
+        echo "## pushing from main to pushdest"
+        hg -R main push pushdest $@
+    fi
+    echo "## post push state"
+    echo "# obstore: main"
+    hg -R main     debugobsolete | sort
+    echo "# obstore: pushdest"
+    hg -R pushdest debugobsolete | sort
+    echo "# obstore: pulldest"
+    hg -R pulldest debugobsolete | sort
+    if [ -n "$target" ]; then
+        echo "## pulling \"$targetnode\"" from main into pulldest
+        hg -R pulldest pull -r $targetnode $@ main
+    else
+        echo "## pulling from main into pulldest"
+        hg -R pulldest pull main $@
+    fi
+    echo "## post pull state"
+    echo "# obstore: main"
+    hg -R main     debugobsolete | sort
+    echo "# obstore: pushdest"
+    hg -R pushdest debugobsolete | sort
+    echo "# obstore: pulldest"
+    hg -R pulldest debugobsolete | sort
+
+    cd ..
+
+}

File tests/dummyssh

+#!/usr/bin/env python
+
+import sys
+import os
+
+os.chdir(os.getenv('TESTTMP'))
+
+if sys.argv[1] != "user@dummy":
+    sys.exit(-1)
+
+os.environ["SSH_CLIENT"] = "127.0.0.1 1 2"
+
+log = open("dummylog", "ab")
+log.write("Got arguments")
+for i, arg in enumerate(sys.argv[1:]):
+    log.write(" %d:%s" % (i + 1, arg))
+log.write("\n")
+log.close()
+hgcmd = sys.argv[2]
+if os.name == 'nt':
+    # hack to make simple unix single quote quoting work on windows
+    hgcmd = hgcmd.replace("'", '"')
+r = os.system(hgcmd)
+sys.exit(bool(r))

File tests/test-corrupt.t

   adding manifests
   adding file changes
   added 1 changesets with 2 changes to 2 files
+  OBSEXC: computing relevant nodes
+  OBSEXC: computing markers relevant to 4 nodes
+  OBSEXC: pushing 2 markers (147 bytes)
+  OBSEXC: DONE
   $ hg -R ../other verify
   checking changesets
   checking manifests

File tests/test-drop.t

+
+  $ cat >> $HGRCPATH <<EOF
+  > [extensions]
+  > hgext.rebase=
+  > hgext.graphlog=
+  > EOF
+  $ echo "drophack=$(echo $(dirname $TESTDIR))/hgext/drophack.py" >> $HGRCPATH
+  $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext/evolve.py" >> $HGRCPATH
+  $ mkcommit() {
+  >    echo "$1" > "$1"
+  >    hg add "$1"
+  >    hg ci -m "add $1"
+  > }
+  $ summary() {
+  > echo ============ graph ==============
+  > hg log -G
+  > echo ============ hidden =============
+  > hg log --hidden -G
+  > echo ============ obsmark ============
+  > hg debugobsolete
+  > }
+
+
+  $ hg init repo
+  $ cd repo
+  $ mkcommit base
+
+drop a single changeset without any rewrite
+================================================
+
+
+  $ mkcommit simple-single
+  $ summary
+  ============ graph ==============
+  @  changeset:   1:d4e7845543ff
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     add simple-single
+  |
+  o  changeset:   0:b4952fcf48cf
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     add base
+  
+  ============ hidden =============
+  @  changeset:   1:d4e7845543ff
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     add simple-single
+  |
+  o  changeset:   0:b4952fcf48cf
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     add base
+  
+  ============ obsmark ============
+  $ hg drop .
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  working directory now at b4952fcf48cf
+  search obsmarker: wall * comb * user * sys * (glob)
+  0 obsmarkers found
+  search nodes: wall * comb * user * sys * (glob)
+  1 nodes found
+  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d4e7845543ff-drophack.hg
+  strip nodes: wall * comb * user * sys * (glob)
+  $ summary
+  ============ graph ==============
+  @  changeset:   0:b4952fcf48cf
+     tag:         tip
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     add base
+  
+  ============ hidden =============
+  @  changeset:   0:b4952fcf48cf
+     tag:         tip
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     add base
+  
+  ============ obsmark ============
+
+Try to drop a changeset with children
+================================================
+
+  $ mkcommit parent
+  $ mkcommit child
+  $ summary
+  ============ graph ==============
+  @  changeset:   2:34b6c051bf1f
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     add child
+  |
+  o  changeset:   1:19509a42b0d0
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     add parent
+  |
+  o  changeset:   0:b4952fcf48cf
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     add base
+  
+  ============ hidden =============
+  @  changeset:   2:34b6c051bf1f
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     add child
+  |
+  o  changeset:   1:19509a42b0d0
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     add parent
+  |
+  o  changeset:   0:b4952fcf48cf
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     add base
+  
+  ============ obsmark ============
+  $ hg drop 1
+  cannot drop revision with children (no-eol)
+  [1]
+  $ summary
+  ============ graph ==============
+  @  changeset:   2:34b6c051bf1f
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     add child
+  |
+  o  changeset:   1:19509a42b0d0
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     add parent
+  |
+  o  changeset:   0:b4952fcf48cf
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     add base
+  
+  ============ hidden =============
+  @  changeset:   2:34b6c051bf1f
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     add child
+  |
+  o  changeset:   1:19509a42b0d0
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     add parent
+  |
+  o  changeset:   0:b4952fcf48cf
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     add base
+  
+  ============ obsmark ============
+
+Try to drop a public changeset
+================================================
+
+  $ hg phase --public 2
+  $ hg drop 2
+  cannot drop public revision (no-eol)
+  [1]
+
+
+Try to drop a changeset with rewrite
+================================================
+
+  $ hg phase --force --draft 2
+  $ echo babar >> child
+  $ hg commit --amend
+  $ summary
+  ============ graph ==============
+  @  changeset:   4:a2c06c884bfe
+  |  tag:         tip
+  |  parent:      1:19509a42b0d0
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     add child
+  |
+  o  changeset:   1:19509a42b0d0
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     add parent
+  |
+  o  changeset:   0:b4952fcf48cf
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     add base
+  
+  ============ hidden =============
+  @  changeset:   4:a2c06c884bfe
+  |  tag:         tip
+  |  parent:      1:19509a42b0d0
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     add child
+  |
+  | x  changeset:   3:87ea30a976fd
+  | |  user:        test
+  | |  date:        Thu Jan 01 00:00:00 1970 +0000
+  | |  summary:     temporary amend commit for 34b6c051bf1f
+  | |
+  | x  changeset:   2:34b6c051bf1f
+  |/   user:        test
+  |    date:        Thu Jan 01 00:00:00 1970 +0000
+  |    summary:     add child
+  |
+  o  changeset:   1:19509a42b0d0
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     add parent
+  |
+  o  changeset:   0:b4952fcf48cf
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     add base
+  
+  ============ obsmark ============
+  34b6c051bf1f78db6aef400776de5cb964470207 a2c06c884bfe53d3840026248bd8a7eafa152df8 0 {'date': '* *', 'user': 'test'} (glob)
+  87ea30a976fdf235bf096f04899cb02a903873e2 0 {'date': '* *', 'user': 'test'} (glob)
+  $ hg drop .
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  working directory now at 19509a42b0d0
+  search obsmarker: wall * comb * user * sys * (glob)
+  1 obsmarkers found
+  search nodes: wall * comb * user * sys * (glob)
+  2 nodes found
+  strip obsmarker: wall * comb * user * sys * (glob)
+  saved backup bundle to $TESTTMP/repo/.hg/strip-backup/*-drophack.hg (glob)
+  strip nodes: wall * comb * user * sys * (glob)
+  $ summary
+  ============ graph ==============
+  @  changeset:   1:19509a42b0d0
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     add parent
+  |
+  o  changeset:   0:b4952fcf48cf
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     add base
+  
+  ============ hidden =============
+  @  changeset:   1:19509a42b0d0
+  |  tag:         tip
+  |  user:        test
+  |  date:        Thu Jan 01 00:00:00 1970 +0000
+  |  summary:     add parent
+  |
+  o  changeset:   0:b4952fcf48cf
+     user:        test
+     date:        Thu Jan 01 00:00:00 1970 +0000
+     summary:     add base
+  
+  ============ obsmark ============
+  87ea30a976fdf235bf096f04899cb02a903873e2 0 {'date': '* *', 'user': 'test'} (glob)

File tests/test-evolve.t

   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files
+  OBSEXC: pull obsolescence markers
+  OBSEXC: no unknown remote markers
+  OBSEXC: DONE
   $ cd alpha
 
   $ cat << EOF > A
   adding manifests
   adding file changes
   added 1 changesets with 1 changes to 1 files
+  OBSEXC: pull obsolescence markers
+  OBSEXC: merging obsolescence markers (171 bytes)
+  OBSEXC: 2 markers added
+  OBSEXC: DONE
   (run 'hg update' to get a working copy)
   $ hg up
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   5	: add 3 - test
   11	: add 1 - test
 
+Test obsstore stat
+
+  $ hg debugobsstorestat
+  markers total:                     10
+      for known precursors:          10
+      with parents data:              0
+  markers with no successors:         0
+                1 successors:        10
+                2 successors:         0
+      more than 2 successors:         0
+  average meta length:               27
+      available  keys:
+                 date:               10
+                 user:               10
+  disconnected clusters:              1
+          any known node:             1
+          smallest length:           10
+          longer length:             10
+          median length:             10
+          mean length:               10
+      using parents data:             1
+          any known node:             1
+          smallest length:           10
+          longer length:             10
+          median length:             10
+          mean length:               10
+
 
 Test evolving renames
 

File tests/test-exchange-A1.t

+
+Initial setup
+
+  $ . $TESTDIR/_exc-util.sh
+
+==== A.1.1 pushing a single head ====
+..
+.. {{{
+..     ⇠◔ A
+..      |
+..      ● O
+.. }}}
+..
+.. Marker exist from:
+..
+..  * A
+..
+.. Command run:
+..
+..  * hg push -r A
+..  * hg push
+..
+.. Expected exchange:
+..
+..  * chain from A
+
+Setup
+---------------
+
+initial
+
+  $ setuprepos A.1.1
+  creating test repo for test case A.1.1
+  - pulldest
+  - main
+  - pushdest
+  cd into `main` and proceed with env setup
+  $ cd main
+  $ mkcommit A
+  $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa `getid 'desc(A)'`
+  $ hg log -G
+  @  f5bc6836db60 (draft): A
+  |
+  o  a9bdc8b26820 (public): O
+  
+  $ hg debugobsolete
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+  $ cd ..
+  $ cd ..
+
+setup both variants
+
+  $ cp -r A.1.1 A.1.1.a
+  $ cp -r A.1.1 A.1.1.b
+
+
+Variante a: push -r A
+---------------------
+
+  $ dotest A.1.1.a A
+  ## Running testcase A.1.1.a
+  # testing echange of "A" (f5bc6836db60)
+  ## initial state
+  # obstore: main
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+  # obstore: pushdest
+  # obstore: pulldest
+  ## pushing "A" from main to pushdest
+  pushing to pushdest
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  OBSEXC: computing relevant nodes
+  OBSEXC: computing markers relevant to 2 nodes
+  OBSEXC: pushing 1 markers (62 bytes)
+  OBSEXC: DONE
+  ## post push state
+  # obstore: main
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+  # obstore: pushdest
+  aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa f5bc6836db60e308a17ba08bf050154ba9c4fad7 0 {'date': '', 'user': 'test'}
+  # obstore: pulldest
+  ## pulling "f5bc6836db60" from main into pulldest
+  pulling from main
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  OBSEXC: pull obsolescence markers
+  OBSEXC: merging obsolescence markers (62 bytes)