changeset 14156:839086b25c36

share: create 'hgrc' using an opener, like clone
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Sun, 01 May 2011 18:43:20 +0200
parents 921683f14ad7
children a8f136f430da
files mercurial/hg.py
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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"))