changeset 1133:899b619a7eb2

Create [web] section with short username as contact on hg init and hg clone.
author Thomas Arendsen Hein <thomas@intevation.de>
date Sun, 28 Aug 2005 18:27:24 +0200
parents 92525920ad29
children 2cd33ea2f66b
files mercurial/commands.py mercurial/localrepo.py
diffstat 2 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sun Aug 28 18:13:28 2005 +0200
+++ b/mercurial/commands.py	Sun Aug 28 18:27:24 2005 +0200
@@ -587,8 +587,8 @@
         repo = hg.repository(ui, dest, create=1)
         repo.pull(other)
 
-    f = repo.opener("hgrc", "w")
-    f.write("[paths]\n")
+    f = repo.opener("hgrc", "a")
+    f.write("\n[paths]\n")
     f.write("default = %s\n" % abspath)
 
     if not opts['noupdate']:
--- a/mercurial/localrepo.py	Sun Aug 28 18:13:28 2005 +0200
+++ b/mercurial/localrepo.py	Sun Aug 28 18:27:24 2005 +0200
@@ -27,11 +27,6 @@
 
         self.root = os.path.abspath(path)
         self.ui = ui
-
-        if create:
-            os.mkdir(self.path)
-            os.mkdir(self.join("data"))
-
         self.opener = util.opener(self.path)
         self.wopener = util.opener(self.root)
         self.manifest = manifest.manifest(self.opener)
@@ -39,6 +34,13 @@
         self.tagscache = None
         self.nodetagscache = None
 
+        if create:
+            os.mkdir(self.path)
+            os.mkdir(self.join("data"))
+            f = self.opener("hgrc", "w")
+            f.write("[web]\n")
+            f.write("contact = %s\n" % ui.shortuser(ui.username()))
+
         self.dirstate = dirstate.dirstate(self.opener, ui, self.root)
         try:
             self.ui.readconfig(self.opener("hgrc"))