如何(是否可能)创建运行多个命令的 hg 命令别名?
我想在 hgrc 文件中定义一个 Mercurial 命令别名来调用多个命令。例如,我想做类似以下的事情:
[alias]
giveup = revert --all --no-backup; purge
syncprod = fetch production; push production
这将允许我调用 hgsyncprod 并让它调用获取,然后调用推送。无法确定该功能是否存在。 (我猜这意味着不。)
I would like to define a Mercurial command alias in my hgrc file that invokes multiple commands. For example I would like to do something like the following:
[alias]
giveup = revert --all --no-backup; purge
syncprod = fetch production; push production
This would allow me to call hg syncprod
and have it invoke a fetch and then a push. Haven't been able to determine if this capability exists. (I'm guessing that means no.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用这样的 shell 别名样式:
不过,我个人只是为它们创建一个 bash 别名,这样我就可以完全跳过
hg
部分。Use the shell alias style like this:
Though, personally I'd just create a bash alias for those so I could skip the
hg
part altogether.要在 Windows 上执行此操作,以下语法对我有用,而无需使用 PowerShell 或 cygwin。
或者,无论恢复是否成功,此版本都将执行清除:
可以将两个以上的命令串在一起,例如:
To do this on Windows, the following syntax worked for me, without having to use PowerShell or cygwin.
Alternatively, this version will execute the purge regardless of whether the revert was successful:
It is possible to string together more than two commands, for instance:
(Bozydar Sobczak 于 2012 年 4 月 7 日留下的评论)
(Comment left by Bozydar Sobczak Apr 7, 2012)