diff mercurial/help/revsets.txt @ 14098:9f5a0acb0056

revset aliases
author Alexander Solovyov <alexander@solovyov.net>
date Sat, 30 Apr 2011 18:30:14 +0200
parents 305c97670d7a
children 0be6dc3d8083
line wrap: on
line diff
--- a/mercurial/help/revsets.txt	Sat Apr 30 19:41:53 2011 +0200
+++ b/mercurial/help/revsets.txt	Sat Apr 30 18:30:14 2011 +0200
@@ -61,6 +61,26 @@
 
 .. predicatesmarker
 
+New predicates (known as "aliases") can be defined, using any combination of
+existing predicates or other aliases. An alias definition looks like::
+
+  <alias> = <definition>
+
+in the ``revsetalias`` section of ``.hgrc``. Arguments of the form `$1`, `$2`,
+etc. are substituted from the alias into the definition.
+
+For example,
+
+::
+
+  [revsetalias]
+  h = heads()
+  d($1) = sort($1, date)
+  rs($1, $2) = reverse(sort($1, $2))
+
+defines three aliases, ``h``, ``d``, and ``rs``. ``rs(0:tip, author)`` is
+exactly equivalent to ``reverse(sort(0:tip, author))``.
+
 Command line equivalents for :hg:`log`::
 
   -f    ->  ::.