mercurial/commands.py
changeset 20572 c724cb0141ee
parent 20570 c21e1e3ab915
child 20573 02d0d3aa42e3
--- a/mercurial/commands.py	Wed Feb 26 18:56:27 2014 -0800
+++ b/mercurial/commands.py	Thu Feb 27 13:46:32 2014 -0600
@@ -1462,7 +1462,8 @@
     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 @@
     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'))