Mercurial > evolve
changeset 5193:a4d081923c81
compat: update hg-X.Y compat comments and test them
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Tue, 10 Mar 2020 19:05:08 +0700 |
parents | f5b366a31740 |
children | f478ac0a818f |
files | hgext3rd/evolve/__init__.py hgext3rd/evolve/cmdrewrite.py hgext3rd/evolve/compat.py hgext3rd/evolve/evolvecmd.py hgext3rd/evolve/obshistory.py hgext3rd/evolve/safeguard.py hgext3rd/pullbundle.py hgext3rd/serverminitopic.py hgext3rd/topic/__init__.py hgext3rd/topic/compat.py hgext3rd/topic/discovery.py hgext3rd/topic/flow.py hgext3rd/topic/revset.py hgext3rd/topic/server.py hgext3rd/topic/topicmap.py tests/test-check-compat-strings.t |
diffstat | 16 files changed, 42 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/__init__.py Tue Mar 10 19:04:33 2020 +0700 +++ b/hgext3rd/evolve/__init__.py Tue Mar 10 19:05:08 2020 +0700 @@ -1306,7 +1306,7 @@ statemod.addunfinished(b'pick', fname=b'pickstate', continueflag=True, abortfunc=cmdrewrite.hgabortpick) else: - # compat <= hg-5.0 (5f2f6912c9e6) + # hg <= 5.0 (5f2f6912c9e6) estate = (b'evolvestate', False, False, _(b'evolve in progress'), _(b"use 'hg evolve --continue' or 'hg evolve --abort' to abort")) cmdutil.unfinishedstates.append(estate)
--- a/hgext3rd/evolve/cmdrewrite.py Tue Mar 10 19:04:33 2020 +0700 +++ b/hgext3rd/evolve/cmdrewrite.py Tue Mar 10 19:05:08 2020 +0700 @@ -520,7 +520,8 @@ try: uipathfn = scmutil.getuipathfn(repo) except AttributeError: - uipathfn = match.rel # <= 4.9 + # hg <= 4.9 (e6ec0737b706) + uipathfn = match.rel for f in sorted(badfiles): if f in s.clean:
--- a/hgext3rd/evolve/compat.py Tue Mar 10 19:04:33 2020 +0700 +++ b/hgext3rd/evolve/compat.py Tue Mar 10 19:05:08 2020 +0700 @@ -28,7 +28,7 @@ arraytobytes = array.array.tostring arrayfrombytes = array.array.fromstring -# hg <= 5.3 (c21aca51b392) +# hg <= 5.2 (c21aca51b392) try: from mercurial import pathutil dirs = pathutil.dirs @@ -78,7 +78,7 @@ islink=b'l' in flags, isexec=b'x' in flags, copysource=copied.get(path)) - # compat with hg <= 4.9 + # hg <= 4.9 (550a172a603b) elif varnames[2] == r"changectx": mctx = context.memfilectx(repo, ctx, fctx.path(), fctx.data(), islink=b'l' in flags, @@ -86,10 +86,8 @@ copied=copied.get(path)) # pytype: disable=wrong-keyword-args return mctx -# 46c2b19a1263f18a5829a21b7a5053019b0c5a31 in hg moved repair.stripbmrevset to -# scmutil.bookmarkrevs -# This change is a part of 4.7 cycle, so drop this when we drop support for hg <= 4.6 try: + # hg <= 4.6 (46c2b19a1263) bmrevset = repair.stripbmrevset # pytype: disable=module-attr except AttributeError: bmrevset = scmutil.bookmarkrevs @@ -100,7 +98,7 @@ """A complete copy-patse of copies._fullcopytrace with a one line fix to handle when the base is not parent of both c1 and c2. This should be converted in a compat function once https://phab.mercurial-scm.org/D3896 - gets in and once we drop support for 4.7, this should be removed.""" + gets in and once we drop support for 4.6, this should be removed.""" from mercurial import pathutil @@ -121,7 +119,7 @@ if util.safehasattr(base, 'isancestorof'): dirtyc1 = not base.isancestorof(_c1) dirtyc2 = not base.isancestorof(_c2) - else: # hg <= 4.6 + else: # hg <= 4.6 (fbec9c0b32d3) dirtyc1 = not base.descendant(_c1) dirtyc2 = not base.descendant(_c2) graft = dirtyc1 or dirtyc2 @@ -129,7 +127,7 @@ if graft: tca = _c1.ancestor(_c2) - # hg < 4.8 compat (dc50121126ae) + # hg <= 4.9 (dc50121126ae) try: limit = copies._findlimit(repo, c1, c2) # pytype: disable=module-attr except (AttributeError, TypeError): @@ -350,7 +348,7 @@ return copy, movewithdir, diverge, renamedelete, dirmove -# hg <= 4.9 compat (7694b685bb10) +# hg <= 4.9 (7694b685bb10) fixupstreamed = util.safehasattr(scmutil, 'movedirstate') if not fixupstreamed: copies._fullcopytracing = fixedcopytracing @@ -365,7 +363,7 @@ return {'helpcategory': category} # nodemap.get and index.[has_node|rev|get_rev] -# hg <= 5.3 (02802fa87b74) +# hg <= 5.2 (02802fa87b74) def getgetrev(cl): """Returns index.get_rev or nodemap.get (for pre-5.3 Mercurial).""" if util.safehasattr(cl.index, 'get_rev'):
--- a/hgext3rd/evolve/evolvecmd.py Tue Mar 10 19:04:33 2020 +0700 +++ b/hgext3rd/evolve/evolvecmd.py Tue Mar 10 19:05:08 2020 +0700 @@ -781,7 +781,7 @@ try: effectflag = obsutil.geteffectflag(prec, (succ,)) except TypeError: - # hg <= 4.7 + # hg <= 4.7 (bae6f1418a95) effectflag = obsutil.geteffectflag((prec, (succ,))) metadata[obsutil.EFFECTFLAGFIELD] = b"%d" % effectflag
--- a/hgext3rd/evolve/obshistory.py Tue Mar 10 19:04:33 2020 +0700 +++ b/hgext3rd/evolve/obshistory.py Tue Mar 10 19:05:08 2020 +0700 @@ -153,7 +153,7 @@ super(obsmarker_printer, self).__init__(ui, repo, *args, **kwargs) diffopts = kwargs.get('diffopts', {}) - # Compat 4.6 + # hg <= 4.6 (3fe1c9263024) if not util.safehasattr(self, "_includediff"): self._includediff = diffopts and diffopts.get(b'patch')
--- a/hgext3rd/evolve/safeguard.py Tue Mar 10 19:04:33 2020 +0700 +++ b/hgext3rd/evolve/safeguard.py Tue Mar 10 19:05:08 2020 +0700 @@ -19,7 +19,7 @@ eh = exthelper.exthelper() -# hg <= 4.8 +# hg <= 4.8 (33d30fb1e4ae) if b'auto-publish' not in configitems.coreitems.get(b'experimental', {}): eh.configitem(b'experimental', b'auto-publish', b'publish')
--- a/hgext3rd/pullbundle.py Tue Mar 10 19:04:33 2020 +0700 +++ b/hgext3rd/pullbundle.py Tue Mar 10 19:05:08 2020 +0700 @@ -640,7 +640,7 @@ ui.progress(topic, pos, item, unit, total) # nodemap.get and index.[has_node|rev|get_rev] -# hg <= 5.3 (02802fa87b74) +# hg <= 5.2 (02802fa87b74) def getgetrev(cl): """Returns index.get_rev or nodemap.get (for pre-5.3 Mercurial).""" if util.safehasattr(cl.index, 'get_rev'):
--- a/hgext3rd/serverminitopic.py Tue Mar 10 19:04:33 2020 +0700 +++ b/hgext3rd/serverminitopic.py Tue Mar 10 19:05:08 2020 +0700 @@ -158,7 +158,7 @@ if util.safehasattr(self, '_entries'): _entries = self._entries else: - # hg <= 4.9 (624d6683c705, b137a6793c51) + # hg <= 4.9 (624d6683c705+b137a6793c51) _entries = self new = self.__class__(_entries, self.tipnode, self.tiprev, self.filteredhash, self._closednodes) @@ -232,10 +232,10 @@ def uisetup(ui): wrapclass(branchmap, 'branchcache', _topiccache) try: - # Mercurial 4.8 and older + # hg <= 4.9 (3461814417f3) extensions.wrapfunction(branchmap, 'read', wrapread) except AttributeError: - # Mercurial 4.9; branchcache.fromfile now takes care of this + # Mercurial 5.0; branchcache.fromfile now takes care of this # which is alredy defined on _topiccache pass extensions.wrapfunction(wireprotov1server, '_capabilities', wireprotocaps)
--- a/hgext3rd/topic/__init__.py Tue Mar 10 19:04:33 2020 +0700 +++ b/hgext3rd/topic/__init__.py Tue Mar 10 19:05:08 2020 +0700 @@ -481,7 +481,7 @@ reporef = weakref.ref(self) if self.ui.configbool(b'experimental', b'enforce-single-head'): - if util.safehasattr(tr, 'validator'): # hg <= 4.7 + if util.safehasattr(tr, 'validator'): # hg <= 4.7 (ebbba3ba3f66) origvalidator = tr.validator else: origvalidator = tr._validator @@ -491,7 +491,7 @@ flow.enforcesinglehead(repo, tr2) origvalidator(tr2) - if util.safehasattr(tr, 'validator'): # hg <= 4.7 + if util.safehasattr(tr, 'validator'): # hg <= 4.7 (ebbba3ba3f66) tr.validator = validator else: tr._validator = validator @@ -500,7 +500,7 @@ b'topic-mode.server', b'ignore') ispush = (desc.startswith(b'push') or desc.startswith(b'serve')) if (topicmodeserver != b'ignore' and ispush): - if util.safehasattr(tr, 'validator'): # hg <= 4.7 + if util.safehasattr(tr, 'validator'): # hg <= 4.7 (ebbba3ba3f66) origvalidator = tr.validator else: origvalidator = tr._validator @@ -509,7 +509,7 @@ repo = reporef() flow.rejectuntopicedchangeset(repo, tr2) return origvalidator(tr2) - if util.safehasattr(tr, 'validator'): # hg <= 4.7 + if util.safehasattr(tr, 'validator'): # hg <= 4.7 (ebbba3ba3f66) tr.validator = validator else: tr._validator = validator @@ -531,7 +531,7 @@ b'topic.allow-publish', True) if not allow_publish: - if util.safehasattr(tr, 'validator'): # hg <= 4.7 + if util.safehasattr(tr, 'validator'): # hg <= 4.7 (ebbba3ba3f66) origvalidator = tr.validator else: origvalidator = tr._validator @@ -540,7 +540,7 @@ repo = reporef() flow.reject_publish(repo, tr2) return origvalidator(tr2) - if util.safehasattr(tr, 'validator'): # hg <= 4.7 + if util.safehasattr(tr, 'validator'): # hg <= 4.7 (ebbba3ba3f66) tr.validator = validator else: tr._validator = validator
--- a/hgext3rd/topic/compat.py Tue Mar 10 19:04:33 2020 +0700 +++ b/hgext3rd/topic/compat.py Tue Mar 10 19:05:08 2020 +0700 @@ -32,7 +32,7 @@ return {'helpcategory': category} # nodemap.get and index.[has_node|rev|get_rev] -# hg <= 5.3 (02802fa87b74) +# hg <= 5.2 (02802fa87b74) def getgetrev(cl): """Returns index.get_rev or nodemap.get (for pre-5.3 Mercurial).""" if util.safehasattr(cl.index, 'get_rev'):
--- a/hgext3rd/topic/discovery.py Tue Mar 10 19:04:33 2020 +0700 +++ b/hgext3rd/topic/discovery.py Tue Mar 10 19:05:08 2020 +0700 @@ -157,7 +157,7 @@ return tr._prepushheads = _nbheads(op.repo) reporef = weakref.ref(op.repo) - if util.safehasattr(tr, 'validator'): # hg <= 4.7 + if util.safehasattr(tr, 'validator'): # hg <= 4.7 (ebbba3ba3f66) oldvalidator = tr.validator else: oldvalidator = tr._validator @@ -178,7 +178,7 @@ % branch) raise error.Abort(msg) return oldvalidator(tr) - if util.safehasattr(tr, 'validator'): # hg <= 4.7 + if util.safehasattr(tr, 'validator'): # hg <= 4.7 (ebbba3ba3f66) tr.validator = validator else: tr._validator = validator
--- a/hgext3rd/topic/flow.py Tue Mar 10 19:04:33 2020 +0700 +++ b/hgext3rd/topic/flow.py Tue Mar 10 19:05:08 2020 +0700 @@ -101,7 +101,8 @@ def installpushflag(ui): entry = extensions.wrapcommand(commands.table, b'push', wrappush) - if not any(opt for opt in entry[1] if opt[1] == b'publish'): # hg <= 4.9 + if not any(opt for opt in entry[1] if opt[1] == b'publish'): + # hg <= 4.8 (9b8d1ad851f8) entry[1].append((b'', b'publish', False, _(b'push the changeset as public'))) extensions.wrapfunction(exchange.pushoperation, '__init__',
--- a/hgext3rd/topic/revset.py Tue Mar 10 19:04:33 2020 +0700 +++ b/hgext3rd/topic/revset.py Tue Mar 10 19:05:08 2020 +0700 @@ -124,6 +124,7 @@ b'relation subscript bounds must be integers', None, None) else: + # hg <= 4.9 (431cf2c8c839+13f7a6a4f0db) a = b = z s = revset.getset(repo, revset.fullreposet(repo), x)
--- a/hgext3rd/topic/server.py Tue Mar 10 19:04:33 2020 +0700 +++ b/hgext3rd/topic/server.py Tue Mar 10 19:05:08 2020 +0700 @@ -16,7 +16,7 @@ ) repoviewutil.subsettable except (AttributeError, ImportError): - # hg <= 4.8 + # hg <= 4.9 (caebe5e7f4bd) from mercurial import branchmap as repoviewutil from . import (
--- a/hgext3rd/topic/topicmap.py Tue Mar 10 19:04:33 2020 +0700 +++ b/hgext3rd/topic/topicmap.py Tue Mar 10 19:05:08 2020 +0700 @@ -125,7 +125,7 @@ branchmap.branchcache = topiccache try: - # Mercurial 4.9 + # Mercurial 5.0 class remotetopiccache(_topiccache, branchmap.remotebranchcache): pass branchmap.remotebranchcache = remotetopiccache @@ -135,7 +135,7 @@ return _wrapupdatebmcache(orig.__get__(self), repo) extensions.wrapfunction(branchmap.BranchMapCache, 'updatecache', _wrapupdatebmcachemethod) except AttributeError: - # Mercurial 4.8 and before + # hg <= 4.9 (3461814417f3) extensions.wrapfunction(branchmap, 'updatecache', _wrapupdatebmcache) @@ -173,7 +173,7 @@ if util.safehasattr(self, '_entries'): _entries = self._entries else: - # hg <= 4.9 (624d6683c705, b137a6793c51) + # hg <= 4.9 (624d6683c705+b137a6793c51) _entries = self new = self.__class__(_entries, self.tipnode, self.tiprev, self.filteredhash, self._closednodes)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-check-compat-strings.t Tue Mar 10 19:05:08 2020 +0700 @@ -0,0 +1,8 @@ +Enable obsolescence to avoid the warning issue when obsmarkers are found + + $ cat << EOF >> $HGRCPATH + > [experimental] + > evolution = all + > EOF + + $ $TESTDIR/../contrib/check-compat-strings.sh "$TESTDIR/../hgext3rd/" "$RUNTESTDIR/.."