default path support with .hg/hgrc
authormpm@selenic.com
Tue, 14 Jun 2005 18:37:53 -0800
changeset 338 1e091b3293d5
parent 337 c3d873ef4b31
child 339 a76fc9c4b67b
default path support with .hg/hgrc -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 default path support with .hg/hgrc hg init creates a new .hgrc file containing a default path pointing to where we pulled from. hg pull now uses "default" as the default source. manifest hash: 0908e3b0648f92a63a3b58e49107cedf07ca0fb4 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCr5SBywK+sNU5EO8RAmvRAKCPdItvtxYyAOgG24732J7PZMFnVgCfe21B MoilYzCQi5GOswS2mk0aE6M= =Gude -----END PGP SIGNATURE-----
mercurial/commands.py
--- a/mercurial/commands.py	Tue Jun 14 18:36:09 2005 -0800
+++ b/mercurial/commands.py	Tue Jun 14 18:37:53 2005 -0800
@@ -334,13 +334,20 @@
             try:
                 os.remove(".hg/dirstate")
             except: pass
+
+            repo = hg.repository(ui, ".")
+
         else:
             repo = hg.repository(ui, ".", create=1)
             other = hg.repository(ui, source)
             cg = repo.getchangegroup(other)
             repo.addchangegroup(cg)
     else:
-        hg.repository(ui, ".", create=1)
+        repo = hg.repository(ui, ".", create=1)
+
+    f = repo.opener("hgrc", "w")
+    f.write("[paths]\n")
+    f.write("default = %s\n" % source)
 
 def log(ui, repo, f):
     """show the revision history of a single file"""
@@ -409,7 +416,7 @@
                 raise "patch failed!"
         repo.commit(files, text)
 
-def pull(ui, repo, source):
+def pull(ui, repo, source="default"):
     """pull changes from the specified source"""
     paths = {}
     for name, path in ui.configitems("paths"):