# HG changeset patch # User Pierre-Yves David # Date 1401784628 25200 # Node ID 72670e28246086ea91ce43328f7af5a742e8da1e # Parent ef155e3ead8fb354003ca8d33389f6cd78481d45 evolve: compatibility with memfilectx change The future 3.1 have have more sophisticated memfilectx object. We add a compatibility layer for them. diff -r ef155e3ead8f -r 72670e282460 README --- a/README Tue Jun 03 01:22:31 2014 -0700 +++ b/README Tue Jun 03 01:37:08 2014 -0700 @@ -50,6 +50,7 @@ 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. diff -r ef155e3ead8f -r 72670e282460 hgext/evolve.py --- a/hgext/evolve.py Tue Jun 03 01:22:31 2014 -0700 +++ b/hgext/evolve.py Tue Jun 03 01:37:08 2014 -0700 @@ -36,13 +36,9 @@ obsolete._enabled = True from mercurial import wireproto gboptslist = getattr(wireproto, 'gboptslist', None) + gboptsmap = getattr(wireproto, 'gboptsmap', None) except (ImportError, AttributeError): - gboptslist = None - -if gboptslist is None: - raise util.Abort('Your Mercurial is too old for this version of Evolve\n' - 'requires version 3.0.1 or above') - + gboptslist = gboptsmap = None from mercurial import base85 @@ -73,7 +69,16 @@ _pack = struct.pack -memfilectx = context.memfilectx +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 # @@ -756,7 +761,7 @@ if path in headmf: fctx = head[path] flags = fctx.flags() - mctx = memfilectx(fctx.path(), fctx.data(), + mctx = memfilectx(repo, fctx.path(), fctx.data(), islink='l' in flags, isexec='x' in flags, copied=copied.get(path)) @@ -1406,7 +1411,7 @@ if path in bumped: fctx = bumped[path] flags = fctx.flags() - mctx = memfilectx(fctx.path(), fctx.data(), + mctx = memfilectx(repo, fctx.path(), fctx.data(), islink='l' in flags, isexec='x' in flags, copied=copied.get(path)) @@ -1836,7 +1841,7 @@ raise IOError() fctx = ctx[path] flags = fctx.flags() - mctx = memfilectx(fctx.path(), fctx.data(), + mctx = memfilectx(repo, fctx.path(), fctx.data(), islink='l' in flags, isexec='x' in flags, copied=copied.get(path))