mercurial/commands.py
changeset 22383 f58b41f6708b
parent 22381 392ae5cb8d62
child 22390 e2806b8613ca
equal deleted inserted replaced
22382:d5b04ee8ecf7 22383:f58b41f6708b
  1517 
  1517 
  1518         for f in paths:
  1518         for f in paths:
  1519             if os.path.exists(f):
  1519             if os.path.exists(f):
  1520                 break
  1520                 break
  1521         else:
  1521         else:
       
  1522             from config import samplehgrcs
       
  1523 
       
  1524             if opts.get('global'):
       
  1525                 samplehgrc = samplehgrcs['global']
       
  1526             elif opts.get('local'):
       
  1527                 samplehgrc = samplehgrcs['local']
       
  1528             else:
       
  1529                 samplehgrc = samplehgrcs['user']
       
  1530 
  1522             f = paths[0]
  1531             f = paths[0]
  1523             fp = open(f, "w")
  1532             fp = open(f, "w")
  1524             fp.write(
  1533             fp.write(samplehgrc)
  1525                 '# example config (see "hg help config" for more info)\n'
       
  1526                 '\n'
       
  1527                 '[ui]\n'
       
  1528                 '# name and email, e.g.\n'
       
  1529                 '# username = Jane Doe <jdoe@example.com>\n'
       
  1530                 'username =\n'
       
  1531                 '\n'
       
  1532                 '[extensions]\n'
       
  1533                 '# uncomment these lines to enable some popular extensions\n'
       
  1534                 '# (see "hg help extensions" for more info)\n'
       
  1535                 '# pager =\n'
       
  1536                 '# progress =\n'
       
  1537                 '# color =\n')
       
  1538             fp.close()
  1534             fp.close()
  1539 
  1535 
  1540         editor = ui.geteditor()
  1536         editor = ui.geteditor()
  1541         util.system("%s \"%s\"" % (editor, f),
  1537         util.system("%s \"%s\"" % (editor, f),
  1542                     onerr=util.Abort, errprefix=_("edit failed"),
  1538                     onerr=util.Abort, errprefix=_("edit failed"),