/!\ This page is primarily intended for Mercurial's developers.

Revset Operators Plan

With new revset functions comes new workflows and the desire to quickly enter them. This page serves as a discussion for proposed operators. Currently, we have the following operators:














set difference





Good candidates (i.e. not needing annoying shell escaping) for new operators:

% (bad for windows scripts)
? (interpreted by bash)
, (already used in function)

Other candidates,


One possibility is that we could have two character operators.


This function is extremely handy and allows a quick way to view your current branch. The suggested operator is % (as in mod) though it might make more sense to use a set difference operator. For example,

only(.,@) → .%@
only(@) → @%

On Windows, '%' is a semi-reserved symbol in the following way: using non-bash shells (e.g. cmd.exe but NOT PowerShell, ConEmu, and cmder), %var% is only expanded when 'var' exists and is surrounded by '%'. For example, %home% (case insensitive) is automatically defined, so we get this:

C:\> echo .%home
C:\> echo .%home%

C:\> echo .%foo
C:\> echo .%foo%

Following from this stack overflow answer, it would appear that '%' would work on the command-line and only be problematic in a batch script when conflicting with a variable of the same name.

Another operator could be \ (as in set difference from mathematics),

only(.,@) → .\\@
only(@) → @\\


Navigating history is much easier if there is a way to say 'first child'. One proposal was to overload the parent operator ^ to use negative numbers but that could led to confusion since children are not defined to have an order.


This function does not yet exist but it could possibly provide the convenience of a child operator.

ideas from mpm

Putting here for posterity: http://markmail.org/message/sjnnwa43s4eksu62

CategoryDeveloper CategoryNewFeatures

RevsetOperatorPlan (last edited 2017-05-31 03:55:15 by Sean Farley)