Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 506:1f81ebff98c9
[PATCH] Add ui.expandpath command
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
[PATCH] Add ui.expandpath command
From: Bryan O'Sullivan <bos@serpentine.com>
Add ui.expandpath function.
manifest hash: dd2b9e536b94b453b06604b88ba339d93698b2e0
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
iD8DBQFCwSbMywK+sNU5EO8RAibuAJ9jAMqhR3cbTqbPG3g9M8INgFmbvACgjAU2
LpalLI+zhalEUIf1Uw8W5l8=
=fqB8
-----END PGP SIGNATURE-----
author | mpm@selenic.com |
---|---|
date | Tue, 28 Jun 2005 02:30:36 -0800 |
parents | dc1f735dfaac |
children | 42a660abaf75 |
comparison
equal
deleted
inserted
replaced
505:dc1f735dfaac | 506:1f81ebff98c9 |
---|---|
265 if rev: n = r.lookup(rev) | 265 if rev: n = r.lookup(rev) |
266 sys.stdout.write(r.read(n)) | 266 sys.stdout.write(r.read(n)) |
267 | 267 |
268 def clone(ui, source, dest = None, **opts): | 268 def clone(ui, source, dest = None, **opts): |
269 """make a copy of an existing repository""" | 269 """make a copy of an existing repository""" |
270 paths = {} | 270 source = ui.expandpath(source) |
271 for name, path in ui.configitems("paths"): | |
272 paths[name] = path | |
273 | |
274 if source in paths: source = paths[source] | |
275 | 271 |
276 created = success = False | 272 created = success = False |
277 | 273 |
278 if dest is None: | 274 if dest is None: |
279 dest = os.getcwd() | 275 dest = os.getcwd() |
547 if n != hg.nullid: | 543 if n != hg.nullid: |
548 show_changeset(ui, repo, changenode=n) | 544 show_changeset(ui, repo, changenode=n) |
549 | 545 |
550 def pull(ui, repo, source="default", **opts): | 546 def pull(ui, repo, source="default", **opts): |
551 """pull changes from the specified source""" | 547 """pull changes from the specified source""" |
552 paths = {} | 548 source = ui.expandpath(source) |
553 for name, path in ui.configitems("paths"): | |
554 paths[name] = path | |
555 | |
556 if source in paths: | |
557 source = paths[source] | |
558 | 549 |
559 ui.status('pulling from %s\n' % (source)) | 550 ui.status('pulling from %s\n' % (source)) |
560 | 551 |
561 other = hg.repository(ui, source) | 552 other = hg.repository(ui, source) |
562 cg = repo.getchangegroup(other) | 553 cg = repo.getchangegroup(other) |
569 | 560 |
570 return r | 561 return r |
571 | 562 |
572 def push(ui, repo, dest="default-push"): | 563 def push(ui, repo, dest="default-push"): |
573 """push changes to the specified destination""" | 564 """push changes to the specified destination""" |
574 paths = {} | 565 dest = ui.expandpath(dest) |
575 for name, path in ui.configitems("paths"): | |
576 paths[name] = path | |
577 | |
578 if dest in paths: dest = paths[dest] | |
579 | 566 |
580 if not dest.startswith("ssh://"): | 567 if not dest.startswith("ssh://"): |
581 ui.warn("abort: can only push to ssh:// destinations currently\n") | 568 ui.warn("abort: can only push to ssh:// destinations currently\n") |
582 return 1 | 569 return 1 |
583 | 570 |