Mercurial > evolve
changeset 4123:119fced5a891 stable
topic: add a compatibility to access transaction's validator
The attribute was made private in ebbba3ba3f66.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 21 Sep 2018 17:50:28 +0200 |
parents | 7f18c7e1e744 |
children | 23658110ab26 |
files | hgext3rd/topic/__init__.py hgext3rd/topic/discovery.py |
diffstat | 2 files changed, 25 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py Fri Sep 21 11:58:42 2018 +0200 +++ b/hgext3rd/topic/__init__.py Fri Sep 21 17:50:28 2018 +0200 @@ -454,25 +454,38 @@ reporef = weakref.ref(self) if self.ui.configbool('experimental', 'enforce-single-head'): - origvalidator = tr.validator + if util.safehasattr(tr, 'validator'): # hg <= 4.7 + origvalidator = tr.validator + else: + origvalidator = tr._validator def validator(tr2): repo = reporef() flow.enforcesinglehead(repo, tr2) origvalidator(tr2) - tr.validator = validator + + if util.safehasattr(tr, 'validator'): # hg <= 4.7 + tr.validator = validator + else: + tr._validator = validator topicmodeserver = self.ui.config('experimental', 'topic-mode.server', 'ignore') ispush = (desc.startswith('push') or desc.startswith('serve')) if (topicmodeserver != 'ignore' and ispush): - origvalidator = tr.validator + if util.safehasattr(tr, 'validator'): # hg <= 4.7 + origvalidator = tr.validator + else: + origvalidator = tr._validator def validator(tr2): repo = reporef() flow.rejectuntopicedchangeset(repo, tr2) return origvalidator(tr2) - tr.validator = validator + if util.safehasattr(tr, 'validator'): # hg <= 4.7 + tr.validator = validator + else: + tr._validator = validator elif (self.ui.configbool('experimental', 'topic.publish-bare-branch') and (desc.startswith('push')
--- a/hgext3rd/topic/discovery.py Fri Sep 21 11:58:42 2018 +0200 +++ b/hgext3rd/topic/discovery.py Fri Sep 21 17:50:28 2018 +0200 @@ -153,7 +153,10 @@ return tr._prepushheads = _nbheads(op.repo) reporef = weakref.ref(op.repo) - oldvalidator = tr.validator + if util.safehasattr(tr, 'validator'): # hg <= 4.7 + oldvalidator = tr.validator + else: + oldvalidator = tr._validator def validator(tr): repo = reporef() @@ -171,7 +174,10 @@ % branch) raise error.Abort(msg) return oldvalidator(tr) - tr.validator = validator + if util.safehasattr(tr, 'validator'): # hg <= 4.7 + tr.validator = validator + else: + tr._validator = validator handlecheckheads.params = frozenset() def _pushb2phases(orig, pushop, bundler):