comparison mercurial/hg.py @ 22380:82b2ba904e3e

clone: provide sample username = config entry in .hg/hgrc (issue4359) Some users clone from a server before ever running 'hg config --edit', so they don't see our helpful template for things like enabling the username. Attempt to give them some helpful guidance.
author Augie Fackler <raf@durin42.com>
date Tue, 09 Sep 2014 17:16:24 -0400
parents 4bc1fd86e915
children ce95c15f680b
comparison
equal deleted inserted replaced
22379:38a393d59e77 22380:82b2ba904e3e
430 elif srcrepo and destpeer.capable("pushkey"): 430 elif srcrepo and destpeer.capable("pushkey"):
431 for k, n in srcrepo._bookmarks.iteritems(): 431 for k, n in srcrepo._bookmarks.iteritems():
432 destpeer.pushkey('bookmarks', k, '', hex(n)) 432 destpeer.pushkey('bookmarks', k, '', hex(n))
433 433
434 if destrepo: 434 if destrepo:
435 template = (
436 '# You may want to set your username here if it is not set\n'
437 "# globally, or this repository requires a different\n"
438 '# username from your usual configuration. If you want to\n'
439 '# set something for all of your repositories on this\n'
440 '# computer, try running the command\n'
441 "# 'hg config --edit --global'\n"
442 '# [ui]\n'
443 '# username = Jane Doe <jdoe@example.com>\n'
444 '[paths]\n'
445 'default = %s\n'
446 )
435 fp = destrepo.opener("hgrc", "w", text=True) 447 fp = destrepo.opener("hgrc", "w", text=True)
436 fp.write("[paths]\n")
437 u = util.url(abspath) 448 u = util.url(abspath)
438 u.passwd = None 449 u.passwd = None
439 defaulturl = str(u) 450 defaulturl = str(u)
440 fp.write("default = %s\n" % defaulturl) 451 fp.write(template % defaulturl)
441 fp.close() 452 fp.close()
442 453
443 destrepo.ui.setconfig('paths', 'default', defaulturl, 'clone') 454 destrepo.ui.setconfig('paths', 'default', defaulturl, 'clone')
444 455
445 if update: 456 if update: