changeset 20573:02d0d3aa42e3

config: add example config file when -e called with no config
author Matt Mackall <mpm@selenic.com>
date Thu, 27 Feb 2014 14:01:52 -0600
parents c724cb0141ee
children 5614f8cf0861
files mercurial/commands.py
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Thu Feb 27 13:46:32 2014 -0600
+++ b/mercurial/commands.py	Thu Feb 27 14:01:52 2014 -0600
@@ -1489,6 +1489,22 @@
                 break
         else:
             f = paths[0]
+            fp = open(f, "w")
+            fp.write(
+                '# example config (see "hg help config" for more info)\n'
+                '\n'
+                '[ui]\n'
+                '# set this to your full email address\n'
+                'username =\n'
+                '\n'
+                '[extensions]\n'
+                '# uncomment these lines to enable some popular extensions\n'
+                '# (see "hg help extensions" for more info)\n'
+                '# pager =\n'
+                '# progress =\n'
+                '# color =\n')
+            fp.close()
+
         editor = ui.geteditor()
         util.system("%s \"%s\"" % (editor, f),
                     onerr=util.Abort, errprefix=_("edit failed"),