Download PDF - Monotone

Transcript
Chapter 3: Advanced Uses
47
3.2 Selectors
Revisions can be specified on the monotone command line, precisely, by entering the entire
40-character hexadecimal sha1 code. This can be cumbersome, so monotone also allows
a more general syntax called “selectors” which is less precise but more “human friendly”.
Any command which expects a precise revision ID can also accept a selector in its place; in
fact a revision ID is just a special type of selector which is very precise.
Simple examples
Some selector examples are helpful in clarifying the idea:
a432
Revision IDs beginning with the string a432
[email protected]/2004-04
Revisions written by [email protected] in April 2004.
"[email protected]/2 weeks ago"
Revisions written by [email protected] 2 weeks ago.
graydon/net.venge.monotone.win32/yesterday
Revisions in the net.venge.monotone.win32 branch, written by graydon, yesterday.
A moment’s examination reveals that these specifications are “fuzzy” and indeed may
return multiple values, or may be ambiguous. When ambiguity arises, monotone will inform
you that more detail is required, and list various possibilities. The precise specification of
selectors follows.
Selectors in detail
A selector is a combination of a selector type, which is a single ASCII character, followed
by a : character and a selector string. All selectors strings except for selector type c are
just values. The value is matched against identifiers or certs, depending on its type, in an
attempt to match a single revision. Selectors are matched as prefixes. The current set of
selection types are:
Generic cert selector
Uses selector type c. The selector string has the syntax name or name=value.
The former syntax will select any revision that has a cert with that name,
regardless of value; the latter will match any revision that has a cert with that
name and value. Values to match for can have shell wildcards. For example,
c:tag matches all revisions that have a tag, and c:tag=monotone-0.25 will
match the revision tagged monotone-0.25. (See also the t selector below.)
Author selection
Uses selector type a. For example, a:graydon matches author certs where the
cert value contains graydon.
Key selection
Uses selector type k. For example, k:[email protected] matches all revisions
where at least one cert was signed by the key [email protected]. Instead
of the key’s given name, the local name or the full hash ID of the key can be
specified as well.