mercurial/helptext/revisions.txt
author Pierre-Yves David <pierre-yves.david@octobus.net>
Fri, 01 Oct 2021 18:52:26 +0200
changeset 48125 de793f249852
parent 43632 2e017696181f
permissions -rw-r--r--
dirstatemap: create `_dirs_incr/_dirs_decr` methods on the common class The Rust wrapper does not need them. However having a default, no-op, implementation will help use to write code used by both implementation. Differential Revision: https://phab.mercurial-scm.org/D11570
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30769
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
     1
Mercurial supports several ways to specify revisions.
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
     2
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
     3
Specifying single revisions
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
     4
===========================
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
     5
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
     6
A plain integer is treated as a revision number. Negative integers are
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
     7
treated as sequential offsets from the tip, with -1 denoting the tip,
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
     8
-2 denoting the revision prior to the tip, and so forth.
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
     9
30767
bbb5cc55ab8b help: use a single paragraph to describe full and abbreviated nodeids
Martin von Zweigbergk <martinvonz@google.com>
parents: 20245
diff changeset
    10
A 40-digit hexadecimal string is treated as a unique revision identifier.
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    11
A hexadecimal string less than 40 characters long is treated as a
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    12
unique revision identifier and is referred to as a short-form
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    13
identifier. A short-form identifier is only valid if it is the prefix
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    14
of exactly one full-length identifier.
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    15
16740
43cfe56121d3 help: include bookmarks in 'help revisions' and simplify wording
Kevin Bullock <kbullock@ringworld.org>
parents: 9999
diff changeset
    16
Any other string is treated as a bookmark, tag, or branch name. A
43cfe56121d3 help: include bookmarks in 'help revisions' and simplify wording
Kevin Bullock <kbullock@ringworld.org>
parents: 9999
diff changeset
    17
bookmark is a movable pointer to a revision. A tag is a permanent name
20245
4edd179fefb8 help: branch names primarily denote the tipmost unclosed branch head
Mads Kiilerich <madski@unity3d.com>
parents: 16740
diff changeset
    18
associated with a revision. A branch name denotes the tipmost open branch head
4edd179fefb8 help: branch names primarily denote the tipmost unclosed branch head
Mads Kiilerich <madski@unity3d.com>
parents: 16740
diff changeset
    19
of that branch - or if they are all closed, the tipmost closed head of the
4edd179fefb8 help: branch names primarily denote the tipmost unclosed branch head
Mads Kiilerich <madski@unity3d.com>
parents: 16740
diff changeset
    20
branch. Bookmark, tag, and branch names must not contain the ":" character.
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    21
16740
43cfe56121d3 help: include bookmarks in 'help revisions' and simplify wording
Kevin Bullock <kbullock@ringworld.org>
parents: 9999
diff changeset
    22
The reserved name "tip" always identifies the most recent revision.
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    23
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    24
The reserved name "null" indicates the null revision. This is the
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    25
revision of an empty repository, and the parent of revision 0.
9539
c904e76e3834 help: move help topics from mercurial/help.py to help/*.txt
Martin Geisler <mg@lazybytes.net>
parents:
diff changeset
    26
9540
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    27
The reserved name "." indicates the working directory parent. If no
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    28
working directory is checked out, it is equivalent to null. If an
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    29
uncommitted merge is in progress, "." is the revision of the first
cad36e496640 help: un-indent help topics
Martin Geisler <mg@lazybytes.net>
parents: 9539
diff changeset
    30
parent.
30769
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    31
30771
c2cbc1b050db help: explain that revsets can be used where 1 or 2 revs are wanted
Martin von Zweigbergk <martinvonz@google.com>
parents: 30770
diff changeset
    32
Finally, commands that expect a single revision (like ``hg update``) also
c2cbc1b050db help: explain that revsets can be used where 1 or 2 revs are wanted
Martin von Zweigbergk <martinvonz@google.com>
parents: 30770
diff changeset
    33
accept revsets (see below for details). When given a revset, they use the
c2cbc1b050db help: explain that revsets can be used where 1 or 2 revs are wanted
Martin von Zweigbergk <martinvonz@google.com>
parents: 30770
diff changeset
    34
last revision of the revset. A few commands accept two single revisions
c2cbc1b050db help: explain that revsets can be used where 1 or 2 revs are wanted
Martin von Zweigbergk <martinvonz@google.com>
parents: 30770
diff changeset
    35
(like ``hg diff``). When given a revset, they use the first and the last
c2cbc1b050db help: explain that revsets can be used where 1 or 2 revs are wanted
Martin von Zweigbergk <martinvonz@google.com>
parents: 30770
diff changeset
    36
revisions of the revset.
c2cbc1b050db help: explain that revsets can be used where 1 or 2 revs are wanted
Martin von Zweigbergk <martinvonz@google.com>
parents: 30770
diff changeset
    37
30769
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    38
Specifying multiple revisions
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    39
=============================
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    40
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    41
Mercurial supports a functional language for selecting a set of
30770
d0a758e7002b help: explain what the term "revset" means
Martin von Zweigbergk <martinvonz@google.com>
parents: 30769
diff changeset
    42
revisions. Expressions in this language are called revsets.
30769
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    43
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    44
The language supports a number of predicates which are joined by infix
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    45
operators. Parenthesis can be used for grouping.
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    46
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    47
Identifiers such as branch names may need quoting with single or
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    48
double quotes if they contain characters like ``-`` or if they match
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    49
one of the predefined predicates.
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    50
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    51
Special characters can be used in quoted identifiers by escaping them,
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    52
e.g., ``\n`` is interpreted as a newline. To prevent them from being
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    53
interpreted, strings can be prefixed with ``r``, e.g. ``r'...'``.
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    54
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    55
Operators
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    56
=========
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    57
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    58
There is a single prefix operator:
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    59
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    60
``not x``
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    61
  Changesets not in x. Short form is ``! x``.
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    62
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    63
These are the supported infix operators:
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    64
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    65
``x::y``
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    66
  A DAG range, meaning all changesets that are descendants of x and
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    67
  ancestors of y, including x and y themselves. If the first endpoint
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    68
  is left out, this is equivalent to ``ancestors(y)``, if the second
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    69
  is left out it is equivalent to ``descendants(x)``.
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    70
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    71
  An alternative syntax is ``x..y``.
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    72
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    73
``x:y``
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    74
  All changesets with revision numbers between x and y, both
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    75
  inclusive. Either endpoint can be left out, they default to 0 and
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    76
  tip.
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    77
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    78
``x and y``
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    79
  The intersection of changesets in x and y. Short form is ``x & y``.
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    80
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    81
``x or y``
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    82
  The union of changesets in x and y. There are two alternative short
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    83
  forms: ``x | y`` and ``x + y``.
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    84
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    85
``x - y``
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    86
  Changesets in x but not in y.
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    87
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    88
``x % y``
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    89
  Changesets that are ancestors of x but not ancestors of y (i.e. ::x - ::y).
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    90
  This is shorthand notation for ``only(x, y)`` (see below). The second
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    91
  argument is optional and, if left out, is equivalent to ``only(x)``.
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    92
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    93
``x^n``
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    94
  The nth parent of x, n == 0, 1, or 2.
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    95
  For n == 0, x; for n == 1, the first parent of each changeset in x;
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    96
  for n == 2, the second parent of changeset in x.
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    97
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    98
``x~n``
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
    99
  The nth first ancestor of x; ``x~0`` is x; ``x~3`` is ``x^^^``.
32699
f75d0aa5dc83 revset: lookup descendents for negative arguments to ancestor operator
David Soria Parra <davidsp@fb.com>
parents: 32084
diff changeset
   100
  For n < 0, the nth unambiguous descendent of x.
30769
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   101
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   102
``x ## y``
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   103
  Concatenate strings and identifiers into one string.
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   104
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   105
  All other prefix, infix and postfix operators have lower priority than
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   106
  ``##``. For example, ``a1 ## a2~2`` is equivalent to ``(a1 ## a2)~2``.
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   107
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   108
  For example::
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   109
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   110
    [revsetalias]
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   111
    issue(a1) = grep(r'\bissue[ :]?' ## a1 ## r'\b|\bbug\(' ## a1 ## r'\)')
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   112
32084
091d6b9157da help: apply bulk fixes for indentation and literal blocking issues
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30784
diff changeset
   113
  ``issue(1234)`` is equivalent to
091d6b9157da help: apply bulk fixes for indentation and literal blocking issues
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30784
diff changeset
   114
  ``grep(r'\bissue[ :]?1234\b|\bbug\(1234\)')``
091d6b9157da help: apply bulk fixes for indentation and literal blocking issues
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30784
diff changeset
   115
  in this case. This matches against all of "issue 1234", "issue:1234",
091d6b9157da help: apply bulk fixes for indentation and literal blocking issues
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30784
diff changeset
   116
  "issue1234" and "bug(1234)".
30769
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   117
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   118
There is a single postfix operator:
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   119
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   120
``x^``
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   121
  Equivalent to ``x^1``, the first parent of each changeset in x.
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   122
30784
5dd67f0993ce help: eliminate duplicate text for revset string patterns
Matt Harbison <matt_harbison@yahoo.com>
parents: 30771
diff changeset
   123
Patterns
5dd67f0993ce help: eliminate duplicate text for revset string patterns
Matt Harbison <matt_harbison@yahoo.com>
parents: 30771
diff changeset
   124
========
5dd67f0993ce help: eliminate duplicate text for revset string patterns
Matt Harbison <matt_harbison@yahoo.com>
parents: 30771
diff changeset
   125
5dd67f0993ce help: eliminate duplicate text for revset string patterns
Matt Harbison <matt_harbison@yahoo.com>
parents: 30771
diff changeset
   126
Where noted, predicates that perform string matching can accept a pattern
5dd67f0993ce help: eliminate duplicate text for revset string patterns
Matt Harbison <matt_harbison@yahoo.com>
parents: 30771
diff changeset
   127
string. The pattern may be either a literal, or a regular expression. If the
5dd67f0993ce help: eliminate duplicate text for revset string patterns
Matt Harbison <matt_harbison@yahoo.com>
parents: 30771
diff changeset
   128
pattern starts with ``re:``, the remainder of the pattern is treated as a
5dd67f0993ce help: eliminate duplicate text for revset string patterns
Matt Harbison <matt_harbison@yahoo.com>
parents: 30771
diff changeset
   129
regular expression. Otherwise, it is treated as a literal. To match a pattern
5dd67f0993ce help: eliminate duplicate text for revset string patterns
Matt Harbison <matt_harbison@yahoo.com>
parents: 30771
diff changeset
   130
that actually starts with ``re:``, use the prefix ``literal:``.
5dd67f0993ce help: eliminate duplicate text for revset string patterns
Matt Harbison <matt_harbison@yahoo.com>
parents: 30771
diff changeset
   131
5dd67f0993ce help: eliminate duplicate text for revset string patterns
Matt Harbison <matt_harbison@yahoo.com>
parents: 30771
diff changeset
   132
Matching is case-sensitive, unless otherwise noted.  To perform a case-
5dd67f0993ce help: eliminate duplicate text for revset string patterns
Matt Harbison <matt_harbison@yahoo.com>
parents: 30771
diff changeset
   133
insensitive match on a case-sensitive predicate, use a regular expression,
5dd67f0993ce help: eliminate duplicate text for revset string patterns
Matt Harbison <matt_harbison@yahoo.com>
parents: 30771
diff changeset
   134
prefixed with ``(?i)``.
5dd67f0993ce help: eliminate duplicate text for revset string patterns
Matt Harbison <matt_harbison@yahoo.com>
parents: 30771
diff changeset
   135
32084
091d6b9157da help: apply bulk fixes for indentation and literal blocking issues
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 30784
diff changeset
   136
For example, ``tag(r're:(?i)release')`` matches "release" or "RELEASE"
34948
ff178743e59b help: minor copy editing for grammar
Matt Harbison <matt_harbison@yahoo.com>
parents: 32699
diff changeset
   137
or "Release", etc.
30784
5dd67f0993ce help: eliminate duplicate text for revset string patterns
Matt Harbison <matt_harbison@yahoo.com>
parents: 30771
diff changeset
   138
30769
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   139
Predicates
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   140
==========
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   141
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   142
The following predicates are supported:
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   143
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   144
.. predicatesmarker
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   145
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   146
Aliases
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   147
=======
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   148
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   149
New predicates (known as "aliases") can be defined, using any combination of
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   150
existing predicates or other aliases. An alias definition looks like::
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   151
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   152
  <alias> = <definition>
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   153
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   154
in the ``revsetalias`` section of a Mercurial configuration file. Arguments
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   155
of the form `a1`, `a2`, etc. are substituted from the alias into the
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   156
definition.
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   157
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   158
For example,
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   159
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   160
::
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   161
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   162
  [revsetalias]
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   163
  h = heads()
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   164
  d(s) = sort(s, date)
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   165
  rs(s, k) = reverse(sort(s, k))
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   166
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   167
defines three aliases, ``h``, ``d``, and ``rs``. ``rs(0:tip, author)`` is
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   168
exactly equivalent to ``reverse(sort(0:tip, author))``.
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   169
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   170
Equivalents
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   171
===========
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   172
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   173
Command line equivalents for :hg:`log`::
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   174
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   175
  -f    ->  ::.
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   176
  -d x  ->  date(x)
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   177
  -k x  ->  keyword(x)
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   178
  -m    ->  merge()
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   179
  -u x  ->  user(x)
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   180
  -b x  ->  branch(x)
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   181
  -P x  ->  !::x
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   182
  -l x  ->  limit(expr, x)
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   183
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   184
Examples
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   185
========
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   186
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   187
Some sample queries:
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   188
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   189
- Changesets on the default branch::
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   190
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   191
    hg log -r "branch(default)"
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   192
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   193
- Changesets on the default branch since tag 1.5 (excluding merges)::
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   194
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   195
    hg log -r "branch(default) and 1.5:: and not merge()"
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   196
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   197
- Open branch heads::
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   198
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   199
    hg log -r "head() and not closed()"
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   200
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   201
- Changesets between tags 1.3 and 1.5 mentioning "bug" that affect
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   202
  ``hgext/*``::
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   203
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   204
    hg log -r "1.3::1.5 and keyword(bug) and file('hgext/*')"
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   205
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   206
- Changesets committed in May 2008, sorted by user::
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   207
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   208
    hg log -r "sort(date('May 2008'), user)"
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   209
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   210
- Changesets mentioning "bug" or "issue" that are not in a tagged
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   211
  release::
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   212
e520f0f4b1cf help: merge revsets.txt into revisions.txt
Martin von Zweigbergk <martinvonz@google.com>
parents: 30767
diff changeset
   213
    hg log -r "(keyword(bug) or keyword(issue)) and not ancestors(tag())"
30771
c2cbc1b050db help: explain that revsets can be used where 1 or 2 revs are wanted
Martin von Zweigbergk <martinvonz@google.com>
parents: 30770
diff changeset
   214
34948
ff178743e59b help: minor copy editing for grammar
Matt Harbison <matt_harbison@yahoo.com>
parents: 32699
diff changeset
   215
- Update to the commit that bookmark @ is pointing to, without activating the
30771
c2cbc1b050db help: explain that revsets can be used where 1 or 2 revs are wanted
Martin von Zweigbergk <martinvonz@google.com>
parents: 30770
diff changeset
   216
  bookmark (this works because the last revision of the revset is used)::
c2cbc1b050db help: explain that revsets can be used where 1 or 2 revs are wanted
Martin von Zweigbergk <martinvonz@google.com>
parents: 30770
diff changeset
   217
c2cbc1b050db help: explain that revsets can be used where 1 or 2 revs are wanted
Martin von Zweigbergk <martinvonz@google.com>
parents: 30770
diff changeset
   218
    hg update :@
c2cbc1b050db help: explain that revsets can be used where 1 or 2 revs are wanted
Martin von Zweigbergk <martinvonz@google.com>
parents: 30770
diff changeset
   219
c2cbc1b050db help: explain that revsets can be used where 1 or 2 revs are wanted
Martin von Zweigbergk <martinvonz@google.com>
parents: 30770
diff changeset
   220
- Show diff between tags 1.3 and 1.5 (this works because the first and the
c2cbc1b050db help: explain that revsets can be used where 1 or 2 revs are wanted
Martin von Zweigbergk <martinvonz@google.com>
parents: 30770
diff changeset
   221
  last revisions of the revset are used)::
c2cbc1b050db help: explain that revsets can be used where 1 or 2 revs are wanted
Martin von Zweigbergk <martinvonz@google.com>
parents: 30770
diff changeset
   222
c2cbc1b050db help: explain that revsets can be used where 1 or 2 revs are wanted
Martin von Zweigbergk <martinvonz@google.com>
parents: 30770
diff changeset
   223
    hg diff -r 1.3::1.5