diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1462,7 +1462,8 @@ def commit(ui, repo, *pats, **opts): cmdutil.commitstatus(repo, node, branch, bheads, opts) @command('config|showconfig|debugconfig', - [('u', 'untrusted', None, _('show untrusted configuration options'))], + [('u', 'untrusted', None, _('show untrusted configuration options')), + ('e', 'edit', None, _('start editor'))], _('[-u] [NAME]...')) def config(ui, repo, *values, **opts): """show combined config settings from all hgrc files @@ -1481,6 +1482,19 @@ def config(ui, repo, *values, **opts): Returns 0 on success. """ + if opts.get('edit'): + paths = scmutil.userrcpath() + for f in paths: + if os.path.exists(f): + break + else: + f = paths[0] + editor = ui.geteditor() + util.system("%s \"%s\"" % (editor, f), + onerr=util.Abort, errprefix=_("edit failed"), + out=ui.fout) + return + for f in scmutil.rcpath(): ui.debug('read config from: %s\n' % f) untrusted = bool(opts.get('untrusted')) diff --git a/tests/test-completion.t b/tests/test-completion.t --- a/tests/test-completion.t +++ b/tests/test-completion.t @@ -222,7 +222,7 @@ Show all commands + options branches: active, closed bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure cat: output, rev, decode, include, exclude - config: untrusted + config: untrusted, edit copy: after, force, include, exclude, dry-run debugancestor: debugbuilddag: mergeable-file, overwritten-file, new-file