# HG changeset patch # User Pierre-Yves David # Date 1537545028 -7200 # Node ID 119fced5a89108d0f9527e4b9b8b2b5327c03cbf # Parent 7f18c7e1e744180cb693a8056089c231384efb3c topic: add a compatibility to access transaction's validator The attribute was made private in ebbba3ba3f66. diff -r 7f18c7e1e744 -r 119fced5a891 hgext3rd/topic/__init__.py --- 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') diff -r 7f18c7e1e744 -r 119fced5a891 hgext3rd/topic/discovery.py --- 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):