comparison mercurial/dispatch.py @ 11524:24965bb270b7

dispatch: add shell aliases This patch adds git-style "shell aliases" to Mercurial. Any alias with a definition beginning with a '!' will be treated as a shell alias. For example: [alias] echo = !echo qempty = !hg qrefresh -X "`hg root`" ; echo Emptied patch "`hg qtop`" $ hg echo foo foo $ hg qempty Emptied patch foo $
author Steve Losh <steve@stevelosh.com>
date Wed, 07 Jul 2010 18:49:43 -0400
parents 6ee107782018
children c20c2c4c0c63
comparison
equal deleted inserted replaced
11517:8bbe396883db 11524:24965bb270b7
206 self.fn = fn 206 self.fn = fn
207 self.badalias = True 207 self.badalias = True
208 208
209 return 209 return
210 210
211 if self.definition.startswith('!'):
212 def fn(ui, *args):
213 cmd = '%s %s' % (self.definition[1:], ' '.join(args))
214 return util.system(cmd)
215 self.fn = fn
216 return
217
211 args = shlex.split(self.definition) 218 args = shlex.split(self.definition)
212 cmd = args.pop(0) 219 cmd = args.pop(0)
213 args = map(util.expandpath, args) 220 args = map(util.expandpath, args)
214 221
215 try: 222 try: