diff mercurial/hg.py @ 22837:2be7d5ebd4d0

config: use the same hgrc for a cloned repo as for an uninitted repo This just copies the same local sample hgrc, except it sets the default path to the repo it was cloned from. This is cut-and-paste from the local sample hgrc, but I think it's acceptable, since the two pieces of code are right next to each other and they're small. There is danger of them going out of synch, but it would complicate the code too much to get rid of this C&P. I also add ui as an import to hg.py, but with demandimport, this should not be a noticeable performance hit.
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Mon, 06 Oct 2014 16:35:02 -0400
parents d7b114493315
children e53f6b72a0e4
line wrap: on
line diff
--- a/mercurial/hg.py	Wed Oct 08 07:45:51 2014 -0400
+++ b/mercurial/hg.py	Mon Oct 06 16:35:02 2014 -0400
@@ -9,9 +9,11 @@
 from i18n import _
 from lock import release
 from node import nullid
+
 import localrepo, bundlerepo, unionrepo, httppeer, sshpeer, statichttprepo
 import bookmarks, lock, util, extensions, error, node, scmutil, phases, url
 import cmdutil, discovery, repoview, exchange
+import ui as uimod
 import merge as mergemod
 import verify as verifymod
 import errno, os, shutil
@@ -429,18 +431,7 @@
 
         destrepo = destpeer.local()
         if destrepo:
-            template = (
-                '# You may want to set your username here if it is not set\n'
-                "# globally, or this repository requires a different\n"
-                '# username from your usual configuration. If you want to\n'
-                '# set something for all of your repositories on this\n'
-                '# computer, try running the command\n'
-                "# 'hg config --edit --global'\n"
-                '# [ui]\n'
-                '# username = Jane Doe <jdoe@example.com>\n'
-                '[paths]\n'
-                'default = %s\n'
-                )
+            template = uimod.samplehgrcs['cloned']
             fp = destrepo.opener("hgrc", "w", text=True)
             u = util.url(abspath)
             u.passwd = None