[PATCH 5 of 8] Create [web] section with short username as contact on hg init and hg clone

Thomas Arendsen Hein thomas at intevation.de
Sun Aug 28 11:54:55 CDT 2005


# HG changeset patch
# User Thomas Arendsen Hein <thomas at intevation.de>
# Node ID 899b619a7eb2312d0006ff8120dc3589d865c10c
# Parent  92525920ad291a2f9cc9248ac0fef8134f51926b
Create [web] section with short username as contact on hg init and hg clone.

diff -r 92525920ad29 -r 899b619a7eb2 mercurial/commands.py
--- a/mercurial/commands.py	Sun Aug 28 16:13:28 2005
+++ b/mercurial/commands.py	Sun Aug 28 16:27:24 2005
@@ -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']:
diff -r 92525920ad29 -r 899b619a7eb2 mercurial/localrepo.py
--- a/mercurial/localrepo.py	Sun Aug 28 16:13:28 2005
+++ b/mercurial/localrepo.py	Sun Aug 28 16:27:24 2005
@@ -27,17 +27,19 @@
 
         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)
         self.changelog = changelog.changelog(self.opener)
         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:


More information about the Mercurial mailing list