Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 338:1e091b3293d5
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-----
author | mpm@selenic.com |
---|---|
date | Tue, 14 Jun 2005 18:37:53 -0800 |
parents | 74b9332faece |
children | a76fc9c4b67b |
comparison
equal
deleted
inserted
replaced
337:c3d873ef4b31 | 338:1e091b3293d5 |
---|---|
332 ui.debug("copying by hardlink\n") | 332 ui.debug("copying by hardlink\n") |
333 os.system("cp -al %s/.hg .hg" % source) | 333 os.system("cp -al %s/.hg .hg" % source) |
334 try: | 334 try: |
335 os.remove(".hg/dirstate") | 335 os.remove(".hg/dirstate") |
336 except: pass | 336 except: pass |
337 | |
338 repo = hg.repository(ui, ".") | |
339 | |
337 else: | 340 else: |
338 repo = hg.repository(ui, ".", create=1) | 341 repo = hg.repository(ui, ".", create=1) |
339 other = hg.repository(ui, source) | 342 other = hg.repository(ui, source) |
340 cg = repo.getchangegroup(other) | 343 cg = repo.getchangegroup(other) |
341 repo.addchangegroup(cg) | 344 repo.addchangegroup(cg) |
342 else: | 345 else: |
343 hg.repository(ui, ".", create=1) | 346 repo = hg.repository(ui, ".", create=1) |
347 | |
348 f = repo.opener("hgrc", "w") | |
349 f.write("[paths]\n") | |
350 f.write("default = %s\n" % source) | |
344 | 351 |
345 def log(ui, repo, f): | 352 def log(ui, repo, f): |
346 """show the revision history of a single file""" | 353 """show the revision history of a single file""" |
347 f = relpath(repo, [f])[0] | 354 f = relpath(repo, [f])[0] |
348 | 355 |
407 if files: | 414 if files: |
408 if os.system("patch -p%d < %s %s" % (strip, pf, quiet)): | 415 if os.system("patch -p%d < %s %s" % (strip, pf, quiet)): |
409 raise "patch failed!" | 416 raise "patch failed!" |
410 repo.commit(files, text) | 417 repo.commit(files, text) |
411 | 418 |
412 def pull(ui, repo, source): | 419 def pull(ui, repo, source="default"): |
413 """pull changes from the specified source""" | 420 """pull changes from the specified source""" |
414 paths = {} | 421 paths = {} |
415 for name, path in ui.configitems("paths"): | 422 for name, path in ui.configitems("paths"): |
416 paths[name] = path | 423 paths[name] = path |
417 | 424 |