# HG changeset patch # User Anton Shestakov # Date 1668254889 -14400 # Node ID ef8c1637321a759fdf4cf4c443e9265a4a5ca373 # Parent f4ffe1e67a9b3f80b591237a95b2993c47e6d17d topic: mercurial.configitems and mercurial.registrar.configitem is in hg 4.3 diff -r f4ffe1e67a9b -r ef8c1637321a hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Sat Nov 12 15:47:57 2022 +0400 +++ b/hgext3rd/topic/__init__.py Sat Nov 12 16:08:09 2022 +0400 @@ -168,6 +168,7 @@ changelog, cmdutil, commands, + configitems, context, encoding, error, @@ -238,58 +239,53 @@ minimumhgversion = b'4.8' buglink = b'https://bz.mercurial-scm.org/' -if util.safehasattr(registrar, 'configitem'): - - from mercurial import configitems - - configtable = {} - configitem = registrar.configitem(configtable) +configtable = {} +configitem = registrar.configitem(configtable) - configitem(b'experimental', b'enforce-topic', - default=False, - ) - configitem(b'experimental', b'enforce-single-head', - default=False, - ) - configitem(b'experimental', b'topic-mode', - default=None, - ) - configitem(b'experimental', b'topic.publish-bare-branch', - default=False, - ) - configitem(b'experimental', b'topic.allow-publish', - default=configitems.dynamicdefault, - ) - configitem(b'_internal', b'keep-topic', - default=False, - ) - configitem(b'experimental', b'topic-mode.server', - default=configitems.dynamicdefault, - ) - configitem(b'experimental', b'topic.server-gate-topic-changesets', - default=False, - ) - configitem(b'experimental', b'topic.linear-merge', - default="reject", - ) +configitem(b'experimental', b'enforce-topic', + default=False, +) +configitem(b'experimental', b'enforce-single-head', + default=False, +) +configitem(b'experimental', b'topic-mode', + default=None, +) +configitem(b'experimental', b'topic.publish-bare-branch', + default=False, +) +configitem(b'experimental', b'topic.allow-publish', + default=configitems.dynamicdefault, +) +configitem(b'_internal', b'keep-topic', + default=False, +) +configitem(b'experimental', b'topic-mode.server', + default=configitems.dynamicdefault, +) +configitem(b'experimental', b'topic.server-gate-topic-changesets', + default=False, +) +configitem(b'experimental', b'topic.linear-merge', + default="reject", +) - def extsetup(ui): - # register config that strictly belong to other code (thg, core, etc) - # - # To ensure all config items we used are registered, we register them if - # nobody else did so far. - from mercurial import configitems - extraitem = functools.partial(configitems._register, ui._knownconfig) - if (b'experimental' not in ui._knownconfig - or not ui._knownconfig[b'experimental'].get(b'thg.displaynames')): - extraitem(b'experimental', b'thg.displaynames', - default=None, - ) - if (b'devel' not in ui._knownconfig - or not ui._knownconfig[b'devel'].get(b'random')): - extraitem(b'devel', b'randomseed', - default=None, - ) +def extsetup(ui): + # register config that strictly belong to other code (thg, core, etc) + # + # To ensure all config items we used are registered, we register them if + # nobody else did so far. + extraitem = functools.partial(configitems._register, ui._knownconfig) + if (b'experimental' not in ui._knownconfig + or not ui._knownconfig[b'experimental'].get(b'thg.displaynames')): + extraitem(b'experimental', b'thg.displaynames', + default=None, + ) + if (b'devel' not in ui._knownconfig + or not ui._knownconfig[b'devel'].get(b'random')): + extraitem(b'devel', b'randomseed', + default=None, + ) def _contexttns(self, force=False): if not force and not self.mutable():