Show More
@@ -211,7 +211,7 b' An alias can start with an exclamation p' | |||||
211 | shell alias. A shell alias is executed with the shell and will let you |
|
211 | shell alias. A shell alias is executed with the shell and will let you | |
212 | run arbitrary commands. As an example, :: |
|
212 | run arbitrary commands. As an example, :: | |
213 |
|
213 | |||
214 | echo = !echo |
|
214 | echo = !echo $@ | |
215 |
|
215 | |||
216 | will let you do ``hg echo foo`` to have ``foo`` printed in your |
|
216 | will let you do ``hg echo foo`` to have ``foo`` printed in your | |
217 | terminal. A better example might be:: |
|
217 | terminal. A better example might be:: | |
@@ -221,11 +221,17 b' terminal. A better example might be::' | |||||
221 | which will make ``hg purge`` delete all unknown files in the |
|
221 | which will make ``hg purge`` delete all unknown files in the | |
222 | repository in the same manner as the purge extension. |
|
222 | repository in the same manner as the purge extension. | |
223 |
|
223 | |||
224 | Shell aliases are executed in an environment where ``$HG`` expand to |
|
224 | Positional arguments like ``$1``, ``$2``, etc. in the alias definition | |
|
225 | expand to the command arguments. Unmatched arguments are | |||
|
226 | removed. ``$0`` expands to the alias name and ``$@`` expands to all | |||
|
227 | arguments separated by a space. These expansions happen before the | |||
|
228 | command is passed to the shell. | |||
|
229 | ||||
|
230 | Shell aliases are executed in an environment where ``$HG`` expands to | |||
225 | the path of the Mercurial that was used to execute the alias. This is |
|
231 | the path of the Mercurial that was used to execute the alias. This is | |
226 | useful when you want to call further Mercurial commands in a shell |
|
232 | useful when you want to call further Mercurial commands in a shell | |
227 | alias, as was done above for the purge alias. In addition, |
|
233 | alias, as was done above for the purge alias. In addition, | |
228 | ``$HG_ARGS`` expand to the arguments given to Mercurial. In the ``hg |
|
234 | ``$HG_ARGS`` expands to the arguments given to Mercurial. In the ``hg | |
229 | echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``. |
|
235 | echo foo`` call above, ``$HG_ARGS`` would expand to ``echo foo``. | |
230 |
|
236 | |||
231 | .. note:: Some global configuration options such as ``-R`` are |
|
237 | .. note:: Some global configuration options such as ``-R`` are |
General Comments 0
You need to be logged in to leave comments.
Login now