##// END OF EJS Templates
[PATCH] Add ui.expandpath command...
mpm@selenic.com -
r506:1f81ebff default
parent child Browse files
Show More
@@ -267,11 +267,7 b' def cat(ui, repo, file, rev = []):'
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
@@ -549,12 +545,7 b' def parents(ui, repo, node = None):'
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
@@ -571,11 +562,7 b' def pull(ui, repo, source="default", **o'
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")
@@ -41,6 +41,13 b' class ui:'
41 return self.cdata.items(section)
41 return self.cdata.items(section)
42 return []
42 return []
43
43
44 def expandpath(self, loc):
45 paths = {}
46 for name, path in self.configitems("paths"):
47 paths[name] = path
48
49 return paths.get(loc, loc)
50
44 def write(self, *args):
51 def write(self, *args):
45 for a in args:
52 for a in args:
46 sys.stdout.write(str(a))
53 sys.stdout.write(str(a))
General Comments 0
You need to be logged in to leave comments. Login now