There is a single prefix operator

not x Files not in x. Short form is ! x.

These are the supported infix operators

x and y The intersection of files in x and y. Short form is x & y.

x or y The union of files in x and y. There are two alternative short forms: x | y and x + y.

x - y Files in x but not in y.

The following predicates are supported

adds(pattern) Changesets that add a file matching pattern.

all() All changesets, the same as 0:tip.

ancestor(single, single) Greatest common ancestor of the two changesets.

ancestors(set) Changesets that are ancestors of a changeset in set.

author(string) Alias for user(string).

bisect(string) Changesets marked in the specified bisect status:

good, bad, skip: csets explicitly marked as good/bad/skip

goods, bads : csets topologicaly good/bad
range : csets taking part in the bisection
pruned : csets that are goods, bads or skipped
untested : csets whose fate is yet unknown
ignored : csets ignored due to DAG topology

bookmark([name]) The named bookmark or all bookmarks.

branch(string or set) All changesets belonging to the given branch or the branches of the given changesets.

children(set) Child changesets of changesets in set.

closed() Changeset is closed

contains(pattern) Revision contains a file matching pattern. See hg help patterns for information about file patterns.

date(interval) Changesets within the interval, see hg help dates.

desc(string) Search commit message for string. The match is case-insensitive.

descendants(set) Changesets which are descendants of changesets in set.

file(pattern) Changesets affecting files matched by pattern.

filelog(pattern) Changesets connected to the specified filelog.

first(set, [n]) An alias for limit().

follow([file]) An alias for ::. (ancestors of the working copy's first parent). If a filename is specified, the history of the given file is followed, including copies.

grep(regex) Like keyword(string) but accepts a regex. Use grep(r'…') to ensure special escape characters are handled correctly. Unlike keyword(string), the match is case-sensitive.

head() Changeset is a named branch head.

heads(set) Members of set with no children in set.

id(string) Revision non-ambiguously specified by the given hex string prefix.

keyword(string) Search commit message, user name, and names of changed files for string. The match is case-insensitive.

last(set, [n]) Last n members of set, defaulting to 1.

limit(set, [n]) First n members of set, defaulting to 1.

max(set) Changeset with highest revision number in set.

merge() Changeset is a merge changeset.

min(set) Changeset with lowest revision number in set.

modifies(pattern) Changesets modifying files matched by pattern.

outgoing([path]) Changesets not found in the specified destination repository, or the default push location.

p1([set]) First parent of changesets in set, or the working directory.

p2([set]) Second parent of changesets in set, or the working directory.

parents([set]) The set of all parents for all changesets in set, or the working directory.

present(set) An empty set, if any revision in set isn't found; otherwise, all revisions in set.

removes(pattern) Changesets which remove files matching pattern.

rev(number) Revision with the given numeric identifier.

reverse(set) Reverse order of set.

roots(set) Changesets with no parent changeset in set.

sort(set[, [-]key…]) Sort set by keys. The default sort order is ascending, specify a key as -key to sort in descending order.

The keys can be:

rev for the revision number,
branch for the branch name,
desc for the commit message (description),
user for user name (author can be used as an alias),
date for the commit date
tag([name])
The specified tag by name, or all tagged revisions if no name is given.
user(string)
User name contains string. The match is case-insensitive.