mercurial/hg.py
changeset 14156 839086b25c36
parent 14076 924c82157d46
child 14161 8a0fca925992
--- a/mercurial/hg.py	Sun May 01 19:51:28 2011 +0200
+++ b/mercurial/hg.py	Sun May 01 18:43:20 2011 +0200
@@ -146,13 +146,14 @@
     file(os.path.join(roothg, 'requires'), 'w').write(requirements)
     file(os.path.join(roothg, 'sharedpath'), 'w').write(sharedpath)
 
+    r = repository(ui, root)
+
     default = srcrepo.ui.config('paths', 'default')
     if default:
-        f = file(os.path.join(roothg, 'hgrc'), 'w')
-        f.write('[paths]\ndefault = %s\n' % default)
-        f.close()
-
-    r = repository(ui, root)
+        fp = r.opener("hgrc", "w", text=True)
+        fp.write("[paths]\n")
+        fp.write("default = %s\n" % default)
+        fp.close()
 
     if update:
         r.ui.status(_("updating working directory\n"))