mercurial/help/revsets.txt
author Martin Geisler <mg@lazybytes.net>
Thu, 17 Jun 2010 17:21:39 +0300
changeset 11382 2f09b13e914d
child 11420 a99ef3711890
permissions -rw-r--r--
help: new revsets topic Based on a patch by timeless which in turn is based on http://selenic.com/pipermail/mercurial-devel/2010-June/021638.html
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11382
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
     1
Mercurial supports a functional language for selecting a set of
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
     2
revisions.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
     3
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
     4
The language supports a number of predicates which are joined by infix
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
     5
operators. Parenthesis can be used for grouping.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
     6
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
     7
Identifiers such as branch names must be quoted with single or double
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
     8
quotes if they contain characters outside of ``[a-zA-Z0-9]`` or if
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
     9
they match one of the predefined predicates. Special characters can be
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    10
used in the identifiers by quoting them, e.g., ``\n`` is interpreted
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    11
as a newline.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    12
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    13
There is a single prefix operator:
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    14
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    15
``not x``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    16
  Changesets not in x. Short form is ``! x``.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    17
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    18
These are the supported infix operators:
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    19
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    20
``x::y``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    21
  A DAG range, meaning all changesets that are descendants of x and
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    22
  ancestors of y, including x and y themselves. If the first endpoint
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    23
  is left out, this is equivalent to ``ancestors(y)``, if the second
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    24
  is left out it is equivalent to ``descendents(x)``.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    25
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    26
  An alternative syntax is ``x..y``.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    27
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    28
``x:y``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    29
  All changesets with revision numbers between x and y, both
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    30
  inclusive. Either endpoint can be left out, they default to 0 and
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    31
  tip.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    32
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    33
``x and y``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    34
  The intersection of changesets in x and y. Short form is ``x & y``.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    35
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    36
``x or y``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    37
  The union of changesets in x and y. There are two alternative short
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    38
  forms: ``x | y`` and ``x + y``.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    39
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    40
``x - y``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    41
  Changesets in x but not in y.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    42
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    43
The following predicates are supported:
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    44
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    45
``adds(pattern)``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    46
  Changesets that add a file matching pattern.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    47
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    48
``all()``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    49
  All changesets, the same as ``0:tip``.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    50
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    51
``ancestor(single, single)``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    52
  Greatest common ancestor of the two changesets.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    53
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    54
``ancestors(set)``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    55
  Changesets that are ancestors of a changeset in set.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    56
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    57
``author(string)``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    58
  Alias for ``user(string)``.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    59
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    60
``branch(set)``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    61
  The branch names are found for changesets in set, and the result is
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    62
  all changesets belonging to one those branches.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    63
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    64
``children(set)``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    65
  Child changesets of changesets in set.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    66
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    67
``closed()``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    68
  Changeset is closed.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    69
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    70
``contains(pattern)``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    71
  Revision contains pattern.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    72
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    73
``date(interval)``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    74
  Changesets within the interval, see :hg:`help dates`.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    75
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    76
``descendants(set)``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    77
  Changesets which are decendants of changesets in set.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    78
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    79
``file(pattern)``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    80
  Changesets which manually affected files matching pattern.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    81
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    82
``follow()``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    83
  An alias for ``::.`` (ancestors of the working copy's first parent).
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    84
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    85
``grep(regex)``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    86
  Like ``keyword(string)`` but accepts a regex.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    87
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    88
``head()``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    89
  Changeset is a head.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    90
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    91
``heads(set)``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    92
  Members of set with no children in set.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    93
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    94
``keyword(string)``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    95
  Search commit message, user name, and names of changed files for
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    96
  string.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    97
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    98
``limit(set, n)``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    99
  First n members of set.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   100
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   101
``max(set)``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   102
  Changeset with highest revision number in set.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   103
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   104
``merge()``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   105
  Changeset is a merge changeset.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   106
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   107
``modifies(pattern)``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   108
  Changesets which modify files matching pattern.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   109
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   110
``outgoing([path])``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   111
  Changesets missing in path.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   112
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   113
``p1(set)``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   114
  First parent of changesets in set.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   115
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   116
``p2(set)``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   117
  Second parent of changesets in set.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   118
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   119
``parents(set)``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   120
  The set of all parents for all changesets in set.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   121
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   122
``removes(pattern)``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   123
  Changesets which remove files matching pattern.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   124
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   125
``reverse(set)``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   126
  Reverse order of set.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   127
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   128
``roots(set)``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   129
  Changesets with no parent changeset in set.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   130
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   131
``sort(set[, [-]key...])``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   132
  Sort set by keys. The default sort order is ascending, specify a key
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   133
  as ``-key`` to sort in descending order.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   134
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   135
  The keys can be:
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   136
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   137
  - ``rev`` for the revision number,
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   138
  - ``branch`` for the branch name,
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   139
  - ``desc`` for the commit message (description),
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   140
  - ``user`` for user name (``author`` can be used as an alias),
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   141
  - ``date`` for the commit date
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   142
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   143
``tagged()``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   144
  Changeset is tagged.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   145
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   146
``user(string)``
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   147
  User name is string.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   148
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   149
Command line equivalents for :hg:`log`::
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   150
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   151
  -f    ->  ::.
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   152
  -d x  ->  date(x)
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   153
  -k x  ->  keyword(x)
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   154
  -m    ->  merge()
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   155
  -u x  ->  user(x)
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   156
  -b x  ->  branch(x)
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   157
  -P x  ->  !::x
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   158
  -l x  ->  limit(expr, x)
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   159
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   160
Some sample queries::
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   161
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   162
  hg log -r 'branch(default)'
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   163
  hg log -r 'branch(default) and 1.5:: and not merge()'
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   164
  hg log -r '1.3::1.5 and keyword(bug) and file("hgext/*")'
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   165
  hg log -r 'sort(date("May 2008"), user)'
2f09b13e914d help: new revsets topic
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
   166
  hg log -r '(keyword(bug) or keyword(issue)) and not ancestors(tagged())'