[PATCH 2 of 3] configitems: use codemod script to register coreconfigitems

Augie Fackler raf at durin42.com
Fri Jul 14 14:39:17 EDT 2017


On Wed, Jul 12, 2017 at 06:22:47PM -0700, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark at fb.com>
> # Date 1499898287 25200
> #      Wed Jul 12 15:24:47 2017 -0700
> # Node ID a0df53ed55b26539c62584231cfcb567594ab34a
> # Parent  695702ea1caedaeeed9a6d63473c0e338adf35f4
> # Available At https://bitbucket.org/quark-zju/hg-draft
> #              hg pull https://bitbucket.org/quark-zju/hg-draft -r a0df53ed55b2
> configitems: use codemod script to register coreconfigitems

Urg. This is kind of unreviewable, because it's gathering configitems
from everywhere and splatting them in one big file, so it's hard to
audit defaults etc.

Could we maybe migrate one file's config items at a time to
configitems.py? I know it'd be a huge series, but I could rip through
that extremely quickly via mail, whereas this big hairball is going to
be very hard to check.

>
> This is the result of running:
>
>   contrib/codemod/codemod_configitems.py mercurial/**/*.py
>
> Plus 2 manual fixes (to make test pass) according to the warning printed by
> the script:
>
>   [warn] mercurial/exchange.py: experimental.bundle2-output-capture: default needs manual removal
>   [warn] mercurial/localrepo.py: experimental.hook-track-tags: default needs manual removal
>
> The script cannot do that automatically because RedBaron cannot figure out
> how to indent things [1].
>
> [1]: https://github.com/PyCQA/redbaron/issues/100
>
> diff --git a/hgext/journal.py b/hgext/journal.py
> --- a/hgext/journal.py
> +++ b/hgext/journal.py
> @@ -303,5 +303,5 @@ class journalstorage(object):
>              l = lock.lock(
>                  vfs, 'namejournal.lock',
> -                int(self.ui.config("ui", "timeout", "600")), desc=desc)
> +                int(self.ui.config("ui", "timeout")), desc=desc)
>              self.ui.warn(_("got lock after %s seconds\n") % l.delay)
>          self._lockref = weakref.ref(l)
> diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
> --- a/hgext/largefiles/overrides.py
> +++ b/hgext/largefiles/overrides.py
> @@ -974,5 +974,5 @@ def overridearchive(orig, repo, dest, no
>      archiver = archival.archivers[kind](dest, mtime or ctx.date()[0])
>
> -    if repo.ui.configbool("ui", "archivemeta", True):
> +    if repo.ui.configbool("ui", "archivemeta"):
>          write('.hg_archival.txt', 0o644, False,
>                lambda: archival.buildmetadata(ctx))
> diff --git a/mercurial/archival.py b/mercurial/archival.py
> --- a/mercurial/archival.py
> +++ b/mercurial/archival.py
> @@ -308,5 +308,5 @@ def archive(repo, dest, node, kind, deco
>      archiver = archivers[kind](dest, mtime or ctx.date()[0])
>
> -    if repo.ui.configbool("ui", "archivemeta", True):
> +    if repo.ui.configbool("ui", "archivemeta"):
>          name = '.hg_archival.txt'
>          if not matchfn or matchfn(name):
> diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
> --- a/mercurial/bookmarks.py
> +++ b/mercurial/bookmarks.py
> @@ -523,5 +523,5 @@ def updatefromremote(ui, repo, remotemar
>      status = ui.status
>      warn = ui.warn
> -    if ui.configbool('ui', 'quietbookmarkmove', False):
> +    if ui.configbool('ui', 'quietbookmarkmove'):
>          status = warn = ui.debug
>
> diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
> --- a/mercurial/bundle2.py
> +++ b/mercurial/bundle2.py
> @@ -1799,5 +1799,5 @@ def handleobsmarker(op, inpart):
>      tr = op.gettransaction()
>      markerdata = inpart.read()
> -    if op.ui.config('experimental', 'obsmarkers-exchange-debug', False):
> +    if op.ui.config('experimental', 'obsmarkers-exchange-debug'):
>          op.ui.write(('obsmarker-exchange: %i bytes received\n')
>                      % len(markerdata))
> diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py
> --- a/mercurial/chgserver.py
> +++ b/mercurial/chgserver.py
> @@ -486,5 +486,5 @@ class chgunixservicehandler(object):
>      def __init__(self, ui):
>          self.ui = ui
> -        self._idletimeout = ui.configint('chgserver', 'idletimeout', 3600)
> +        self._idletimeout = ui.configint('chgserver', 'idletimeout')
>          self._lastactive = time.time()
>
> @@ -498,5 +498,5 @@ class chgunixservicehandler(object):
>      def _inithashstate(self, address):
>          self._baseaddress = address
> -        if self.ui.configbool('chgserver', 'skiphash', False):
> +        if self.ui.configbool('chgserver', 'skiphash'):
>              self._hashstate = None
>              self._realaddress = address
> diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -209,5 +209,5 @@ def recordfilter(ui, originalhunks, oper
>      """
>      usecurses = crecordmod.checkcurses(ui)
> -    testfile = ui.config('experimental', 'crecordtest', None)
> +    testfile = ui.config('experimental', 'crecordtest')
>      oldwrite = setupwrapcolorwrite(ui)
>      try:
> @@ -1688,5 +1688,5 @@ def _lookuplogtemplate(ui, tmpl, style):
>              return logtemplatespec(templater.unquotestring(tmpl), None)
>          else:
> -            style = util.expandpath(ui.config('ui', 'style', ''))
> +            style = util.expandpath(ui.config('ui', 'style'))
>
>      if not tmpl and style:
> @@ -3408,6 +3408,5 @@ def _performrevert(repo, parents, ctx, a
>              operation = 'revert'
>              reversehunks = repo.ui.configbool('experimental',
> -                                              'revertalternateinteractivemode',
> -                                              True)
> +                'revertalternateinteractivemode')
>          if reversehunks:
>              diff = patch.diff(repo, ctx.node(), None, m, opts=diffopts)
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -1228,7 +1228,7 @@ def bundle(ui, repo, fname, dest=None, *
>
>      contentopts = {'cg.version': cgversion}
> -    if repo.ui.configbool('experimental', 'evolution.bundle-obsmarker', False):
> +    if repo.ui.configbool('experimental', 'evolution.bundle-obsmarker'):
>          contentopts['obsolescence'] = True
> -    if repo.ui.configbool('experimental', 'bundle-phases', False):
> +    if repo.ui.configbool('experimental', 'bundle-phases'):
>          contentopts['phases'] = True
>      bundle2.writenewbundle(ui, repo, 'bundle', fname, bversion, outgoing,
> @@ -4525,5 +4525,5 @@ def rollback(ui, repo, **opts):
>      Returns 0 on success, 1 if no rollback data is available.
>      """
> -    if not ui.configbool('ui', 'rollback', True):
> +    if not ui.configbool('ui', 'rollback'):
>          raise error.Abort(_('rollback is disabled because it is unsafe'),
>                            hint=('see `hg help -v rollback` for information'))
> diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py
> --- a/mercurial/commandserver.py
> +++ b/mercurial/commandserver.py
> @@ -157,5 +157,5 @@ class server(object):
>
>          # developer config: cmdserver.log
> -        logpath = ui.config("cmdserver", "log", None)
> +        logpath = ui.config("cmdserver", "log")
>          if logpath:
>              global logfile
> diff --git a/mercurial/configitems.py b/mercurial/configitems.py
> --- a/mercurial/configitems.py
> +++ b/mercurial/configitems.py
> @@ -74,7 +74,28 @@ coreconfigitem('bundle', 'reorder',
>      default='auto',
>  )
> +coreconfigitem('censor', 'policy',
> +    default='abort',
> +)
> +coreconfigitem('chgserver', 'idletimeout',
> +    default=3600,
> +)
> +coreconfigitem('chgserver', 'skiphash',
> +    default=False,
> +)
> +coreconfigitem('cmdserver', 'log',
> +    default=None,
> +)
>  coreconfigitem('color', 'mode',
>      default='auto',
>  )
> +coreconfigitem('commands', 'status.relative',
> +    default=False,
> +)
> +coreconfigitem('commands', 'update.requiredest',
> +    default=False,
> +)
> +coreconfigitem('devel', 'all',
> +    default=False,
> +)
>  coreconfigitem('devel', 'all-warnings',
>      default=False,
> @@ -89,4 +110,10 @@ coreconfigitem('devel', 'check-relroot',
>      default=False,
>  )
> +coreconfigitem('devel', 'default-date',
> +    default=None,
> +)
> +coreconfigitem('devel', 'deprec-warn',
> +    default=False,
> +)
>  coreconfigitem('devel', 'disableloaddefaultcerts',
>      default=False,
> @@ -107,4 +134,97 @@ coreconfigitem('devel', 'strip-obsmarker
>      default=True,
>  )
> +coreconfigitem('email', 'charsets',
> +    default=list,
> +)
> +coreconfigitem('email', 'method',
> +    default='smtp',
> +)
> +coreconfigitem('experimental', 'bundle-phases',
> +    default=False,
> +)
> +coreconfigitem('experimental', 'bundle2-advertise',
> +    default=True,
> +)
> +coreconfigitem('experimental', 'bundle2-output-capture',
> +    default=False,
> +)
> +coreconfigitem('experimental', 'bundle2.pushback',
> +    default=False,
> +)
> +coreconfigitem('experimental', 'bundle2lazylocking',
> +    default=False,
> +)
> +coreconfigitem('experimental', 'bundlecomplevel',
> +    default=None,
> +)
> +coreconfigitem('experimental', 'changegroup3',
> +    default=False,
> +)
> +coreconfigitem('experimental', 'clientcompressionengines',
> +    default=list,
> +)
> +coreconfigitem('experimental', 'crecordtest',
> +    default=None,
> +)
> +coreconfigitem('experimental', 'disablecopytrace',
> +    default=False,
> +)
> +coreconfigitem('experimental', 'editortmpinhg',
> +    default=False,
> +)
> +coreconfigitem('experimental', 'evolution',
> +    default=list,
> +)
> +coreconfigitem('experimental', 'evolution.bundle-obsmarker',
> +    default=False,
> +)
> +coreconfigitem('experimental', 'evolution.track-operation',
> +    default=False,
> +)
> +coreconfigitem('experimental', 'exportableenviron',
> +    default=list,
> +)
> +coreconfigitem('experimental', 'extendedheader.index',
> +    default=None,
> +)
> +coreconfigitem('experimental', 'extendedheader.similarity',
> +    default=False,
> +)
> +coreconfigitem('experimental', 'format.compression',
> +    default='zlib',
> +)
> +coreconfigitem('experimental', 'graphshorten',
> +    default=False,
> +)
> +coreconfigitem('experimental', 'hook-track-tags',
> +    default=False,
> +)
> +coreconfigitem('experimental', 'httppostargs',
> +    default=False,
> +)
> +coreconfigitem('experimental', 'manifestv2',
> +    default=False,
> +)
> +coreconfigitem('experimental', 'mergedriver',
> +    default=None,
> +)
> +coreconfigitem('experimental', 'obsmarkers-exchange-debug',
> +    default=False,
> +)
> +coreconfigitem('experimental', 'revertalternateinteractivemode',
> +    default=True,
> +)
> +coreconfigitem('experimental', 'revlogv2',
> +    default=None,
> +)
> +coreconfigitem('experimental', 'spacemovesdown',
> +    default=False,
> +)
> +coreconfigitem('experimental', 'treemanifest',
> +    default=False,
> +)
> +coreconfigitem('experimental', 'updatecheck',
> +    default=None,
> +)
>  coreconfigitem('format', 'aggressivemergedeltas',
>      default=False,
> @@ -143,4 +263,25 @@ coreconfigitem('hostsecurity', 'disablet
>      default=False,
>  )
> +coreconfigitem('http_proxy', 'always',
> +    default=False,
> +)
> +coreconfigitem('http_proxy', 'host',
> +    default=None,
> +)
> +coreconfigitem('http_proxy', 'no',
> +    default=list,
> +)
> +coreconfigitem('http_proxy', 'passwd',
> +    default=None,
> +)
> +coreconfigitem('http_proxy', 'user',
> +    default=None,
> +)
> +coreconfigitem('merge', 'followcopies',
> +    default=True,
> +)
> +coreconfigitem('pager', 'ignore',
> +    default=list,
> +)
>  coreconfigitem('patch', 'eol',
>      default='strict',
> @@ -149,13 +290,61 @@ coreconfigitem('patch', 'fuzz',
>      default=2,
>  )
> +coreconfigitem('paths', 'default',
> +    default=None,
> +)
> +coreconfigitem('paths', 'default-push',
> +    default=None,
> +)
> +coreconfigitem('phases', 'checksubrepos',
> +    default='follow',
> +)
> +coreconfigitem('phases', 'publish',
> +    default=True,
> +)
> +coreconfigitem('profiling', 'enabled',
> +    default=False,
> +)
> +coreconfigitem('profiling', 'format',
> +    default='text',
> +)
> +coreconfigitem('profiling', 'freq',
> +    default=1000,
> +)
> +coreconfigitem('profiling', 'limit',
> +    default=30,
> +)
> +coreconfigitem('profiling', 'nested',
> +    default=0,
> +)
> +coreconfigitem('profiling', 'sort',
> +    default='inlinetime',
> +)
> +coreconfigitem('profiling', 'statformat',
> +    default='hotpath',
> +)
>  coreconfigitem('progress', 'assume-tty',
>      default=False,
>  )
> +coreconfigitem('progress', 'changedelay',
> +    default=1,
> +)
>  coreconfigitem('progress', 'clear-complete',
>      default=True,
>  )
> +coreconfigitem('progress', 'debug',
> +    default=False,
> +)
> +coreconfigitem('progress', 'delay',
> +    default=3,
> +)
> +coreconfigitem('progress', 'disable',
> +    default=False,
> +)
>  coreconfigitem('progress', 'estimate',
>      default=2,
>  )
> +coreconfigitem('progress', 'refresh',
> +    default=0.1,
> +)
>  coreconfigitem('server', 'bundle1',
>      default=True,
> @@ -179,4 +368,7 @@ coreconfigitem('server', 'preferuncompre
>      default=False,
>  )
> +coreconfigitem('server', 'uncompressed',
> +    default=True,
> +)
>  coreconfigitem('server', 'uncompressedallowsecret',
>      default=False,
> @@ -188,16 +380,169 @@ coreconfigitem('server', 'zliblevel',
>      default=-1,
>  )
> +coreconfigitem('smtp', 'host',
> +    default=None,
> +)
> +coreconfigitem('smtp', 'local_hostname',
> +    default=None,
> +)
> +coreconfigitem('smtp', 'password',
> +    default=None,
> +)
> +coreconfigitem('smtp', 'tls',
> +    default='none',
> +)
> +coreconfigitem('smtp', 'username',
> +    default=None,
> +)
> +coreconfigitem('sparse', 'missingwarning',
> +    default=True,
> +)
> +coreconfigitem('trusted', 'groups',
> +    default=list,
> +)
> +coreconfigitem('trusted', 'users',
> +    default=list,
> +)
> +coreconfigitem('ui', '_usedassubrepo',
> +    default=False,
> +)
> +coreconfigitem('ui', 'allowemptycommit',
> +    default=False,
> +)
> +coreconfigitem('ui', 'archivemeta',
> +    default=True,
> +)
> +coreconfigitem('ui', 'askusername',
> +    default=False,
> +)
> +coreconfigitem('ui', 'clonebundlefallback',
> +    default=False,
> +)
>  coreconfigitem('ui', 'clonebundleprefers',
>      default=list,
>  )
> +coreconfigitem('ui', 'clonebundles',
> +    default=True,
> +)
> +coreconfigitem('ui', 'commitsubrepos',
> +    default=False,
> +)
> +coreconfigitem('ui', 'debug',
> +    default=False,
> +)
> +coreconfigitem('ui', 'debugger',
> +    default=None,
> +)
> +coreconfigitem('ui', 'forcemerge',
> +    default=None,
> +)
> +coreconfigitem('ui', 'formatdebug',
> +    default=False,
> +)
> +coreconfigitem('ui', 'formatjson',
> +    default=False,
> +)
> +coreconfigitem('ui', 'formatted',
> +    default=None,
> +)
> +coreconfigitem('ui', 'graphnodetemplate',
> +    default=None,
> +)
> +coreconfigitem('ui', 'http2debuglevel',
> +    default=None,
> +)
>  coreconfigitem('ui', 'interactive',
>      default=None,
>  )
> +coreconfigitem('ui', 'interface',
> +    default=None,
> +)
> +coreconfigitem('ui', 'logblockedtimes',
> +    default=False,
> +)
> +coreconfigitem('ui', 'logtemplate',
> +    default=None,
> +)
> +coreconfigitem('ui', 'merge',
> +    default=None,
> +)
> +coreconfigitem('ui', 'mergemarkers',
> +    default='basic',
> +)
> +coreconfigitem('ui', 'nontty',
> +    default=False,
> +)
> +coreconfigitem('ui', 'origbackuppath',
> +    default=None,
> +)
> +coreconfigitem('ui', 'paginate',
> +    default=True,
> +)
> +coreconfigitem('ui', 'patch',
> +    default=None,
> +)
> +coreconfigitem('ui', 'portablefilenames',
> +    default='warn',
> +)
> +coreconfigitem('ui', 'promptecho',
> +    default=False,
> +)
>  coreconfigitem('ui', 'quiet',
>      default=False,
>  )
> +coreconfigitem('ui', 'quietbookmarkmove',
> +    default=False,
> +)
> +coreconfigitem('ui', 'remotecmd',
> +    default='hg',
> +)
> +coreconfigitem('ui', 'report_untrusted',
> +    default=True,
> +)
> +coreconfigitem('ui', 'rollback',
> +    default=True,
> +)
> +coreconfigitem('ui', 'slash',
> +    default=False,
> +)
> +coreconfigitem('ui', 'ssh',
> +    default='ssh',
> +)
> +coreconfigitem('ui', 'statuscopies',
> +    default=False,
> +)
> +coreconfigitem('ui', 'strict',
> +    default=False,
> +)
> +coreconfigitem('ui', 'style',
> +    default='',
> +)
> +coreconfigitem('ui', 'supportcontact',
> +    default=None,
> +)
> +coreconfigitem('ui', 'textwidth',
> +    default=78,
> +)
> +coreconfigitem('ui', 'timeout',
> +    default='600',
> +)
> +coreconfigitem('ui', 'traceback',
> +    default=False,
> +)
> +coreconfigitem('ui', 'tweakdefaults',
> +    default=False,
> +)
> +coreconfigitem('ui', 'usehttp2',
> +    default=False,
> +)
>  coreconfigitem('ui', 'username',
>      alias=[('ui', 'user')]
>  )
> +coreconfigitem('ui', 'verbose',
> +    default=False,
> +)
> +coreconfigitem('verify', 'skipflags',
> +    default=None,
> +)
>  # Windows defaults to a limit of 512 open files. A buffer of 128
>  # should give us enough headway.
> diff --git a/mercurial/context.py b/mercurial/context.py
> --- a/mercurial/context.py
> +++ b/mercurial/context.py
> @@ -1232,5 +1232,5 @@ class filectx(basefilectx):
>              return self._filelog.read(self._filenode)
>          except error.CensoredNodeError:
> -            if self._repo.ui.config("censor", "policy", "abort") == "ignore":
> +            if self._repo.ui.config("censor", "policy") == "ignore":
>                  return ""
>              raise error.Abort(_("censored node: %s") % short(self._filenode),
> diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
> --- a/mercurial/dispatch.py
> +++ b/mercurial/dispatch.py
> @@ -917,5 +917,5 @@ def _exceptionwarning(ui):
>      ct = util.versiontuple(n=2)
>      worst = None, ct, ''
> -    if ui.config('ui', 'supportcontact', None) is None:
> +    if ui.config('ui', 'supportcontact') is None:
>          for name, mod in extensions.extensions():
>              testedwith = getattr(mod, 'testedwith', '')
> @@ -951,5 +951,5 @@ def _exceptionwarning(ui):
>                     % (name, testedwith, name, report))
>      else:
> -        bugtracker = ui.config('ui', 'supportcontact', None)
> +        bugtracker = ui.config('ui', 'supportcontact')
>          if bugtracker is None:
>              bugtracker = _("https://mercurial-scm.org/wiki/BugTracker")
> diff --git a/mercurial/exchange.py b/mercurial/exchange.py
> --- a/mercurial/exchange.py
> +++ b/mercurial/exchange.py
> @@ -548,5 +548,5 @@ def _pushdiscoveryphase(pushop):
>      remotephases = pushop.remote.listkeys('phases')
>      publishing = remotephases.get('publishing', False)
> -    if (pushop.ui.configbool('ui', '_usedassubrepo', False)
> +    if (pushop.ui.configbool('ui', '_usedassubrepo')
>          and remotephases    # server supports phases
>          and not pushop.outgoing.missing # no changesets to be pushed
> @@ -994,5 +994,5 @@ def _pushsyncphase(pushop):
>      # even when we don't push, exchanging phase data is useful
>      remotephases = pushop.remote.listkeys('phases')
> -    if (pushop.ui.configbool('ui', '_usedassubrepo', False)
> +    if (pushop.ui.configbool('ui', '_usedassubrepo')
>          and remotephases    # server supports phases
>          and pushop.cgresult is None # nothing was pushed
> @@ -1727,6 +1727,5 @@ def unbundle(repo, cg, heads, source, ur
>      recordout = None
>      # quick fix for output mismatch with bundle2 in 3.4
> -    captureoutput = repo.ui.configbool('experimental', 'bundle2-output-capture',
> -                                       False)
> +    captureoutput = repo.ui.configbool('experimental', 'bundle2-output-capture')
>      if url.startswith('remote:http:') or url.startswith('remote:https:'):
>          captureoutput = True
> @@ -1793,5 +1792,5 @@ def _maybeapplyclonebundle(pullop):
>      remote = pullop.remote
>
> -    if not repo.ui.configbool('ui', 'clonebundles', True):
> +    if not repo.ui.configbool('ui', 'clonebundles'):
>          return
>
> @@ -1842,5 +1841,5 @@ def _maybeapplyclonebundle(pullop):
>      # clients flooding a server that was expecting expensive
>      # clone load to be offloaded.
> -    elif repo.ui.configbool('ui', 'clonebundlefallback', False):
> +    elif repo.ui.configbool('ui', 'clonebundlefallback'):
>          repo.ui.warn(_('falling back to normal clone\n'))
>      else:
> diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
> --- a/mercurial/filemerge.py
> +++ b/mercurial/filemerge.py
> @@ -686,5 +686,5 @@ def _filemerge(premerge, repo, mynode, o
>      r = 1
>      try:
> -        markerstyle = ui.config('ui', 'mergemarkers', 'basic')
> +        markerstyle = ui.config('ui', 'mergemarkers')
>          if not labels:
>              labels = _defaultconflictlabels
> diff --git a/mercurial/help.py b/mercurial/help.py
> --- a/mercurial/help.py
> +++ b/mercurial/help.py
> @@ -648,5 +648,5 @@ def formattedhelp(ui, commands, name, ke
>              else:
>                  section = remaining
> -    textwidth = ui.configint('ui', 'textwidth', 78)
> +    textwidth = ui.configint('ui', 'textwidth')
>      termwidth = ui.termwidth() - 2
>      if textwidth <= 0 or termwidth < textwidth:
> diff --git a/mercurial/httpconnection.py b/mercurial/httpconnection.py
> --- a/mercurial/httpconnection.py
> +++ b/mercurial/httpconnection.py
> @@ -142,5 +142,5 @@ class http2handler(urlreq.httphandler, u
>          self._connections = {}
>          # developer config: ui.http2debuglevel
> -        loglevel = ui.config('ui', 'http2debuglevel', default=None)
> +        loglevel = ui.config('ui', 'http2debuglevel')
>          if loglevel and not _configuredlogging:
>              _configuredlogging = True
> diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py
> --- a/mercurial/httppeer.py
> +++ b/mercurial/httppeer.py
> @@ -182,5 +182,5 @@ class httppeer(wireproto.wirepeer):
>          elif data is not None:
>              size = len(data)
> -        if size and self.ui.configbool('ui', 'usehttp2', False):
> +        if size and self.ui.configbool('ui', 'usehttp2'):
>              headers['Expect'] = '100-Continue'
>              headers['X-HgHttp2'] = '1'
> diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
> --- a/mercurial/localrepo.py
> +++ b/mercurial/localrepo.py
> @@ -453,5 +453,5 @@ class localrepository(object):
>
>      def _restrictcapabilities(self, caps):
> -        if self.ui.configbool('experimental', 'bundle2-advertise', True):
> +        if self.ui.configbool('experimental', 'bundle2-advertise'):
>              caps = set(caps)
>              capsblob = bundle2.encodecaps(bundle2.getrepocaps(self))
> @@ -872,5 +872,5 @@ class localrepository(object):
>          # it's safe (and desirable) to trust the publish flag unconditionally
>          # so that we don't finalize changes shared between users via ssh or nfs
> -        return self.ui.configbool('phases', 'publish', True, untrusted=True)
> +        return self.ui.configbool('phases', 'publish', untrusted=True)
>
>      def cancopy(self):
> @@ -1070,6 +1070,5 @@ class localrepository(object):
>          tracktags = lambda x: None
>          # experimental config: experimental.hook-track-tags
> -        shouldtracktags = self.ui.configbool('experimental', 'hook-track-tags',
> -                                             False)
> +        shouldtracktags = self.ui.configbool('experimental', 'hook-track-tags')
>          if desc != 'strip' and shouldtracktags:
>              oldheads = self.changelog.headrevs()
> @@ -1426,5 +1425,5 @@ class localrepository(object):
>              # default to 600 seconds timeout
>              l = lockmod.lock(vfs, lockname,
> -                             int(self.ui.config("ui", "timeout", "600")),
> +                             int(self.ui.config("ui", "timeout")),
>                               releasefn=releasefn, acquirefn=acquirefn,
>                               desc=desc)
> @@ -2138,5 +2137,5 @@ def newreporequirements(repo):
>                  requirements.add('dotencode')
>
> -    compengine = ui.config('experimental', 'format.compression', 'zlib')
> +    compengine = ui.config('experimental', 'format.compression')
>      if compengine not in util.compengines:
>          raise error.Abort(_('compression engine %s defined by '
> @@ -2152,7 +2151,7 @@ def newreporequirements(repo):
>      if scmutil.gdinitconfig(ui):
>          requirements.add('generaldelta')
> -    if ui.configbool('experimental', 'treemanifest', False):
> +    if ui.configbool('experimental', 'treemanifest'):
>          requirements.add('treemanifest')
> -    if ui.configbool('experimental', 'manifestv2', False):
> +    if ui.configbool('experimental', 'manifestv2'):
>          requirements.add('manifestv2')
>
> diff --git a/mercurial/mail.py b/mercurial/mail.py
> --- a/mercurial/mail.py
> +++ b/mercurial/mail.py
> @@ -79,5 +79,5 @@ def _smtp(ui):
>      '''build an smtp connection and return a function to send mail'''
>      local_hostname = ui.config('smtp', 'local_hostname')
> -    tls = ui.config('smtp', 'tls', 'none')
> +    tls = ui.config('smtp', 'tls')
>      # backward compatible: when tls = true, we use starttls.
>      starttls = tls == 'starttls' or util.parsebool(tls)
> @@ -136,5 +136,5 @@ def _smtp(ui):
>  def _sendmail(ui, sender, recipients, msg):
>      '''send mail using sendmail.'''
> -    program = ui.config('email', 'method', 'smtp')
> +    program = ui.config('email', 'method')
>      cmdline = '%s -f %s %s' % (program, util.email(sender),
>                                 ' '.join(map(util.email, recipients)))
> @@ -165,5 +165,5 @@ def connect(ui, mbox=None):
>          open(mbox, 'wb').close()
>          return lambda s, r, m: _mbox(mbox, s, r, m)
> -    if ui.config('email', 'method', 'smtp') == 'smtp':
> +    if ui.config('email', 'method') == 'smtp':
>          return _smtp(ui)
>      return lambda s, r, m: _sendmail(ui, s, r, m)
> @@ -175,5 +175,5 @@ def sendmail(ui, sender, recipients, msg
>  def validateconfig(ui):
>      '''determine if we have enough config data to try sending email.'''
> -    method = ui.config('email', 'method', 'smtp')
> +    method = ui.config('email', 'method')
>      if method == 'smtp':
>          if not ui.config('smtp', 'host'):
> diff --git a/mercurial/merge.py b/mercurial/merge.py
> --- a/mercurial/merge.py
> +++ b/mercurial/merge.py
> @@ -1614,5 +1614,5 @@ def update(repo, node, branchmerge, forc
>
>          # deprecated config: merge.followcopies
> -        followcopies = repo.ui.configbool('merge', 'followcopies', True)
> +        followcopies = repo.ui.configbool('merge', 'followcopies')
>          if overwrite:
>              followcopies = False
> diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
> --- a/mercurial/obsolete.py
> +++ b/mercurial/obsolete.py
> @@ -991,6 +991,5 @@ def createmarkers(repo, relations, flag=
>          metadata['user'] = repo.ui.username()
>      useoperation = repo.ui.configbool('experimental',
> -                                      'evolution.track-operation',
> -                                      False)
> +        'evolution.track-operation')
>      if useoperation and operation:
>          metadata['operation'] = operation
> diff --git a/mercurial/profiling.py b/mercurial/profiling.py
> --- a/mercurial/profiling.py
> +++ b/mercurial/profiling.py
> @@ -31,8 +31,8 @@ def _loadprofiler(ui, profiler):
>  @contextlib.contextmanager
>  def lsprofile(ui, fp):
> -    format = ui.config('profiling', 'format', default='text')
> -    field = ui.config('profiling', 'sort', default='inlinetime')
> -    limit = ui.configint('profiling', 'limit', default=30)
> -    climit = ui.configint('profiling', 'nested', default=0)
> +    format = ui.config('profiling', 'format')
> +    field = ui.config('profiling', 'sort')
> +    limit = ui.configint('profiling', 'limit')
> +    climit = ui.configint('profiling', 'nested')
>
>      if format not in ['text', 'kcachegrind']:
> @@ -73,5 +73,5 @@ def flameprofile(ui, fp):
>              'https://github.com/evanhempel/python-flamegraph'))
>      # developer config: profiling.freq
> -    freq = ui.configint('profiling', 'freq', default=1000)
> +    freq = ui.configint('profiling', 'freq')
>      filter_ = None
>      collapse_recursion = True
> @@ -93,5 +93,5 @@ def statprofile(ui, fp):
>      from . import statprof
>
> -    freq = ui.configint('profiling', 'freq', default=1000)
> +    freq = ui.configint('profiling', 'freq')
>      if freq > 0:
>          # Cannot reset when profiler is already active. So silently no-op.
> @@ -108,5 +108,5 @@ def statprofile(ui, fp):
>          data = statprof.stop()
>
> -        profformat = ui.config('profiling', 'statformat', 'hotpath')
> +        profformat = ui.config('profiling', 'statformat')
>
>          formats = {
> diff --git a/mercurial/progress.py b/mercurial/progress.py
> --- a/mercurial/progress.py
> +++ b/mercurial/progress.py
> @@ -93,13 +93,13 @@ class progbar(object):
>          self.printed = False
>          self.lastprint = time.time() + float(self.ui.config(
> -            'progress', 'delay', default=3))
> +            'progress', 'delay'))
>          self.curtopic = None
>          self.lasttopic = None
>          self.indetcount = 0
>          self.refresh = float(self.ui.config(
> -            'progress', 'refresh', default=0.1))
> +            'progress', 'refresh'))
>          self.changedelay = max(3 * self.refresh,
>                                 float(self.ui.config(
> -                                   'progress', 'changedelay', default=1)))
> +                                   'progress', 'changedelay')))
>          self.order = self.ui.configlist(
>              'progress', 'format',
> diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
> --- a/mercurial/scmutil.py
> +++ b/mercurial/scmutil.py
> @@ -283,5 +283,5 @@ def checkportabilityalert(ui):
>      '''check if the user's config requests nothing, a warning, or abort for
>      non-portable filenames'''
> -    val = ui.config('ui', 'portablefilenames', 'warn')
> +    val = ui.config('ui', 'portablefilenames')
>      lval = val.lower()
>      bval = util.parsebool(val)
> @@ -554,5 +554,5 @@ def origpath(ui, repo, filepath):
>      Fall back to default (filepath) if not specified
>      '''
> -    origbackuppath = ui.config('ui', 'origbackuppath', None)
> +    origbackuppath = ui.config('ui', 'origbackuppath')
>      if origbackuppath is None:
>          return filepath + ".orig"
> diff --git a/mercurial/sparse.py b/mercurial/sparse.py
> --- a/mercurial/sparse.py
> +++ b/mercurial/sparse.py
> @@ -107,5 +107,5 @@ def patternsforrev(repo, rev):
>                  # experimental config: sparse.missingwarning
>                  if repo.ui.configbool(
> -                        'sparse', 'missingwarning', True):
> +                        'sparse', 'missingwarning'):
>                      repo.ui.warn(msg)
>                  else:
> diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py
> --- a/mercurial/sshpeer.py
> +++ b/mercurial/sshpeer.py
> @@ -147,6 +147,6 @@ class sshpeer(wireproto.wirepeer):
>          self.path = u.path or "."
>
> -        sshcmd = self.ui.config("ui", "ssh", "ssh")
> -        remotecmd = self.ui.config("ui", "remotecmd", "hg")
> +        sshcmd = self.ui.config("ui", "ssh")
> +        remotecmd = self.ui.config("ui", "remotecmd")
>
>          args = util.sshargs(sshcmd,
> diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py
> --- a/mercurial/streamclone.py
> +++ b/mercurial/streamclone.py
> @@ -166,5 +166,5 @@ def maybeperformlegacystreamclone(pullop
>  def allowservergeneration(repo):
>      """Whether streaming clones are allowed from the server."""
> -    if not repo.ui.configbool('server', 'uncompressed', True, untrusted=True):
> +    if not repo.ui.configbool('server', 'uncompressed', untrusted=True):
>          return False
>
> diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py
> --- a/mercurial/subrepo.py
> +++ b/mercurial/subrepo.py
> @@ -402,5 +402,5 @@ def newcommitphase(ui, ctx):
>      if not substate:
>          return commitphase
> -    check = ui.config('phases', 'checksubrepos', 'follow')
> +    check = ui.config('phases', 'checksubrepos')
>      if check not in ('ignore', 'follow', 'abort'):
>          raise error.Abort(_('invalid phases.checksubrepos configuration: %s')
> diff --git a/mercurial/ui.py b/mercurial/ui.py
> --- a/mercurial/ui.py
> +++ b/mercurial/ui.py
> @@ -409,6 +409,6 @@ class ui(object):
>                  self.quiet = self.verbose = False
>              self._reportuntrusted = self.debugflag or self.configbool("ui",
> -                "report_untrusted", True)
> -            self.tracebackflag = self.configbool('ui', 'traceback', False)
> +                "report_untrusted")
> +            self.tracebackflag = self.configbool('ui', 'traceback')
>              self.logblockedtimes = self.configbool('ui', 'logblockedtimes')
>
> @@ -919,5 +919,5 @@ class ui(object):
>
>      def _isatty(self, fh):
> -        if self.configbool('ui', 'nontty', False):
> +        if self.configbool('ui', 'nontty'):
>              return False
>          return util.isatty(fh)
> @@ -942,5 +942,5 @@ class ui(object):
>              or self.pageractive
>              or command in self.configlist('pager', 'ignore')
> -            or not self.configbool('ui', 'paginate', True)
> +            or not self.configbool('ui', 'paginate')
>              or not self.configbool('pager', 'attend-' + command, True)
>              # TODO: if we want to allow HGPLAINEXCEPT=pager,
> @@ -1107,5 +1107,5 @@ class ui(object):
>          # Default interface for all the features
>          defaultinterface = "text"
> -        i = self.config("ui", "interface", None)
> +        i = self.config("ui", "interface")
>          if i in alldefaults:
>              defaultinterface = i
> @@ -1181,5 +1181,5 @@ class ui(object):
>              return False
>
> -        i = self.configbool("ui", "formatted", None)
> +        i = self.configbool("ui", "formatted")
>          if i is None:
>              # some environments replace stdout without implementing isatty
> @@ -1459,5 +1459,5 @@ class ui(object):
>          """setup the progbar singleton to the ui object"""
>          if (self.quiet or self.debugflag
> -                or self.configbool('progress', 'disable', False)
> +                or self.configbool('progress', 'disable')
>                  or not progress.shouldprint(self)):
>              return None
> diff --git a/mercurial/url.py b/mercurial/url.py
> --- a/mercurial/url.py
> +++ b/mercurial/url.py
> @@ -455,5 +455,5 @@ def opener(ui, authinfo=None):
>      '''
>      # experimental config: ui.usehttp2
> -    if ui.configbool('ui', 'usehttp2', False):
> +    if ui.configbool('ui', 'usehttp2'):
>          handlers = [
>              httpconnectionmod.http2handler(
> diff --git a/mercurial/verify.py b/mercurial/verify.py
> --- a/mercurial/verify.py
> +++ b/mercurial/verify.py
> @@ -444,5 +444,5 @@ class verifier(object):
>                  except error.CensoredNodeError:
>                      # experimental config: censor.policy
> -                    if ui.config("censor", "policy", "abort") == "abort":
> +                    if ui.config("censor", "policy") == "abort":
>                          self.err(lr, _("censored file data"), f)
>                  except Exception as inst:
> diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
> --- a/mercurial/wireproto.py
> +++ b/mercurial/wireproto.py
> @@ -765,5 +765,5 @@ def _capabilities(repo, proto):
>          else:
>              caps.append('streamreqs=%s' % ','.join(sorted(requiredformats)))
> -    if repo.ui.configbool('experimental', 'bundle2-advertise', True):
> +    if repo.ui.configbool('experimental', 'bundle2-advertise'):
>          capsblob = bundle2.encodecaps(bundle2.getrepocaps(repo))
>          caps.append('bundle2=' + urlreq.quote(capsblob))
> @@ -773,5 +773,5 @@ def _capabilities(repo, proto):
>          caps.append('httpheader=%d' %
>                      repo.ui.configint('server', 'maxhttpheaderlen'))
> -        if repo.ui.configbool('experimental', 'httppostargs', False):
> +        if repo.ui.configbool('experimental', 'httppostargs'):
>              caps.append('httppostargs')
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list