# HG changeset patch # User Pierre-Yves David # Date 1556018795 -7200 # Node ID 8b3781d9a6166492449274daf44d57ec44f9486e # Parent d081cc4f5fef6adc7d90bf077565c4c7bb4313e4# Parent 63148e999562cefbf6caf345a3aea0e505e44805 branching: merge with stable diff -r d081cc4f5fef -r 8b3781d9a616 CHANGELOG --- a/CHANGELOG Wed Apr 17 00:20:44 2019 +0530 +++ b/CHANGELOG Tue Apr 23 13:26:35 2019 +0200 @@ -1,6 +1,21 @@ Changelog ========= +8.6.0 - in progress +------------------- + + * evolve: drop compatibility with 4.4 + * evolve: reinstalled compatibility with narrow repositories, + +8.5.1 - in progress +------------------- + + * evolve: make sure we use upstream merge code with 5.0, + * evolve: restore compatibility with 4.4 + (This regress the narrow compatibility) + * topic: compatibility with mercurial-5.0, + * topic: improve extensions isolation (issue6121). + 8.5.0 -- 2019-04-23 ------------------- diff -r d081cc4f5fef -r 8b3781d9a616 hgext3rd/evolve/compat.py --- a/hgext3rd/evolve/compat.py Wed Apr 17 00:20:44 2019 +0530 +++ b/hgext3rd/evolve/compat.py Tue Apr 23 13:26:35 2019 +0200 @@ -418,7 +418,7 @@ return copy, movewithdir, diverge, renamedelete, dirmove # hg <= 4.9 compat (7694b685bb10) -fixupstreamed = util.safehasattr(scmutil, '_movedirstate') +fixupstreamed = util.safehasattr(scmutil, 'movedirstate') if not fixupstreamed: copies._fullcopytracing = fixedcopytracing diff -r d081cc4f5fef -r 8b3781d9a616 hgext3rd/evolve/evolvecmd.py diff -r d081cc4f5fef -r 8b3781d9a616 hgext3rd/evolve/metadata.py --- a/hgext3rd/evolve/metadata.py Wed Apr 17 00:20:44 2019 +0530 +++ b/hgext3rd/evolve/metadata.py Tue Apr 23 13:26:35 2019 +0200 @@ -6,6 +6,6 @@ # GNU General Public License version 2 or any later version. __version__ = '8.6.0.dev' -testedwith = '4.4.2 4.5.2 4.6.2 4.7 4.8 4.9' -minimumhgversion = '4.4' +testedwith = '4.5.2 4.6.2 4.7 4.8 4.9' +minimumhgversion = '4.5' buglink = 'https://bz.mercurial-scm.org/' diff -r d081cc4f5fef -r 8b3781d9a616 hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Wed Apr 17 00:20:44 2019 +0530 +++ b/hgext3rd/topic/__init__.py Tue Apr 23 13:26:35 2019 +0200 @@ -139,6 +139,7 @@ ) from . import ( + common, compat, constants, destination, @@ -181,8 +182,8 @@ __version__ = '0.15.0.dev' -testedwith = '4.4.2 4.5.2 4.6.2 4.7 4.8 4.9' -minimumhgversion = '4.4' +testedwith = '4.5.2 4.6.2 4.7 4.8 4.9' +minimumhgversion = '4.5' buglink = 'https://bz.mercurial-scm.org/' if util.safehasattr(registrar, 'configitem'): @@ -257,6 +258,8 @@ topicrev = re.compile(r'^t\d+$') branchrev = re.compile(r'^b\d+$') +hastopicext = common.hastopicext + def _namemap(repo, name): revs = None if stackrev.match(name): @@ -368,6 +371,9 @@ class topicrepo(repo.__class__): + # attribute for other code to distinct between repo with topic and repo without + hastopicext = True + def _restrictcapabilities(self, caps): caps = super(topicrepo, self)._restrictcapabilities(caps) caps.add('topics') @@ -559,6 +565,8 @@ def wrapinit(orig, self, repo, *args, **kwargs): orig(self, repo, *args, **kwargs) + if not hastopicext(repo): + return if constants.extrakey not in self._extra: if getattr(repo, 'currenttopic', ''): self._extra[constants.extrakey] = repo.currenttopic @@ -1114,6 +1122,8 @@ return topicmode def commitwrap(orig, ui, repo, *args, **opts): + if not hastopicext(repo): + return orig(ui, repo, *args, **opts) with repo.wlock(): topicmode = _configtopicmode(ui) ismergecommit = len(repo[None].parents()) == 2 @@ -1155,10 +1165,11 @@ def committextwrap(orig, repo, ctx, subs, extramsg): ret = orig(repo, ctx, subs, extramsg) - t = repo.currenttopic - if t: - ret = ret.replace("\nHG: branch", - "\nHG: topic '%s'\nHG: branch" % t) + if hastopicext(repo): + t = repo.currenttopic + if t: + ret = ret.replace("\nHG: branch", + "\nHG: topic '%s'\nHG: branch" % t) return ret def pushoutgoingwrap(orig, ui, repo, *args, **opts): @@ -1175,6 +1186,8 @@ ist0 = False try: ret = orig(repo, node, branchmerge, force, *args, **kwargs) + if not hastopicext(repo): + return ret # The mergeupdatewrap function makes the destination's topic as the # current topic. This is right for merge but wrong for rebase. We check # if rebase is running and update the currenttopic to topic of new diff -r d081cc4f5fef -r 8b3781d9a616 hgext3rd/topic/common.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hgext3rd/topic/common.py Tue Apr 23 13:26:35 2019 +0200 @@ -0,0 +1,8 @@ +# Copyright 2019 Pierre-Yves David +# +# This software may be used and distributed according to the terms of the +# GNU General Public License version 2 or any later version. + +def hastopicext(repo): + """True if the repo use the topic extension""" + return getattr(repo, 'hastopicext', False) diff -r d081cc4f5fef -r 8b3781d9a616 hgext3rd/topic/destination.py --- a/hgext3rd/topic/destination.py Wed Apr 17 00:20:44 2019 +0530 +++ b/hgext3rd/topic/destination.py Tue Apr 23 13:26:35 2019 +0200 @@ -7,7 +7,10 @@ error, extensions, ) -from . import topicmap +from . import ( + common, + topicmap, +) from .evolvebits import builddependencies def _destmergebranch(orig, repo, action='merge', sourceset=None, @@ -19,7 +22,9 @@ # XXX: using only the max here is flacky. That code should eventually # be updated to take care of the whole sourceset. p1 = repo[max(sourceset)] - top = p1.topic() + top = None + if common.hastopicext(repo): + top = p1.topic() if top: revs = repo.revs('topic(%s) - obsolete()', top) deps, rdeps = builddependencies(repo, revs) @@ -57,6 +62,8 @@ def _destupdatetopic(repo, clean, check=None): """decide on an update destination from current topic""" + if not common.hastopicext(repo): + return None, None, None movemark = node = None topic = repo.currenttopic if topic: @@ -71,6 +78,8 @@ return node, movemark, None def desthistedit(orig, ui, repo): + if not common.hastopicext(repo): + return None if not (ui.config('histedit', 'defaultrev', None) is None and repo.currenttopic): return orig(ui, repo) diff -r d081cc4f5fef -r 8b3781d9a616 hgext3rd/topic/discovery.py --- a/hgext3rd/topic/discovery.py Wed Apr 17 00:20:44 2019 +0530 +++ b/hgext3rd/topic/discovery.py Tue Apr 23 13:26:35 2019 +0200 @@ -12,6 +12,9 @@ extensions, util, ) +from . import ( + common, +) try: from mercurial import wireproto @@ -26,7 +29,10 @@ publishing = ('phases' not in remote.listkeys('namespaces') or bool(remote.listkeys('phases').get('publishing', False))) - if ((publishing or not remote.capable('topics')) + + if not common.hastopicext(pushop.repo): + return orig(pushop, *args, **kwargs) + elif ((publishing or not remote.capable('topics')) and not getattr(pushop, 'publish', False)): return orig(pushop, *args, **kwargs) @@ -117,6 +123,8 @@ remote.branchmap = origremotebranchmap def wireprotobranchmap(orig, repo, proto): + if not common.hastopicext(repo): + return orig(repo, proto) oldrepo = repo.__class__ try: class repocls(repo.__class__): @@ -146,7 +154,7 @@ def handlecheckheads(orig, op, inpart): """This is used to check for new heads when publishing changeset""" orig(op, inpart) - if op.repo.publishing(): + if not common.hastopicext(op.repo) or op.repo.publishing(): return tr = op.gettransaction() if tr.hookargs['source'] not in ('push', 'serve'): # not a push @@ -181,15 +189,16 @@ handlecheckheads.params = frozenset() def _pushb2phases(orig, pushop, bundler): - checktypes = ('check:heads', 'check:updated-heads') - hascheck = any(p.type in checktypes for p in bundler._parts) - if not hascheck and pushop.outdatedphases: - exchange._pushb2ctxcheckheads(pushop, bundler) + if common.hastopicext(pushop.repo): + checktypes = ('check:heads', 'check:updated-heads') + hascheck = any(p.type in checktypes for p in bundler._parts) + if not hascheck and pushop.outdatedphases: + exchange._pushb2ctxcheckheads(pushop, bundler) return orig(pushop, bundler) def wireprotocaps(orig, repo, proto): caps = orig(repo, proto) - if repo.peer().capable('topics'): + if common.hastopicext(repo) and repo.peer().capable('topics'): caps.append('topics') return caps diff -r d081cc4f5fef -r 8b3781d9a616 hgext3rd/topic/topicmap.py --- a/hgext3rd/topic/topicmap.py Wed Apr 17 00:20:44 2019 +0530 +++ b/hgext3rd/topic/topicmap.py Tue Apr 23 13:26:35 2019 +0200 @@ -12,6 +12,10 @@ util, ) +from . import ( + common, +) + basefilter = set(['base', 'immutable']) def topicfilter(name): """return a "topic" version of a filter level""" @@ -30,6 +34,8 @@ return filtername.endswith('-topic') def gettopicrepo(repo): + if not common.hastopicext(repo): + return repo filtername = topicfilter(repo.filtername) if filtername == repo.filtername: return repo