Mercurial:带参数的别名 [英] Mercurial: alias with arguments

查看:66
本文介绍了Mercurial:带参数的别名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个别名,以便在运行时:

I want to create an alias so that when I run:

hg pushbranch <<SOME_BRANCH>>

它的别名为:

hg push -b <<SOME_BRANCH>>

SOME_BRANCH是我要推送的分支的名称.我可以在.hgrc中创建别名,但是不知道如何为别名提供参数.

Where SOME_BRANCH is the name of a branch I wish to push. I can create an alias in my .hgrc, but don't know how I could supply an argument to the alias.

推荐答案

来自 hgrc帮助

别名为$ 1,$ 2等的形式的实参 定义在执行之前由Mercurial扩展.

Positional arguments in the form of $1, $2, etc in the alias definition are expanded by Mercurial before execution.

因此,您的别名定义将允许推送 any 分支

Thus, your alias definition, which will allow to push any branch, will be

pushbranch = push -b $1

hg pushbranch mybranch扩展为hg push -b mybranch

这篇关于Mercurial:带参数的别名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆