Please check out the revset feature

Matt Mackall mpm at selenic.com
Mon Jun 7 11:16:19 CDT 2010


Last week I pushed the revset feature to default. It's available
wherever revision ranges were previously supported. It's quite complex
and needs some testing. (And yes, there are currently no tests or docs!)

Some sample queries:

hg log -r 'branch(default)'
hg log -r 'branch(default) and 1.5:: and not merge()'
hg log -r '1.3::1.5 and keyword(bug) and file("hgext/*")'
hg log -r 'sort(date("May 2008"), user)'
hg log -r '(keyword(bug) or keyword(issue)) and not ancestors(tagged())'

grammar:

expr := 
   ( expr ) 
   expr infix expr
   prefix expr
   expr postfix
   identifier
   "identifier"
   function ( expr )

prefix operators:
  not x / ! x
  :x  all revisions <= x
  ::x  ancestors of x

postfix operators:
  x::  descendants of x
  x:   revisions >= x

infix operators:
  symbol(expression)
  x::y / x..y  dag range
  x:y   existing range operator
  not x
  x and y / x & y
  x or y / x | y / x + y
  x - y  -> x & !y
  x,y -> argument list
  
function-style filters:
 adds(pattern)
 all() -> 0:tip
 ancestor(single, single)
 ancestors(set)
 author(string) alias for user
 branch(set)
 children(set)
 closed() -> changeset is closed
 contains(patterns) -> revision contains pattern
 date(daterange)
 descendants(set)
 file(pattern)
 follow() -> ::.
 grep(regex)  like keyword but with regex
 head() -> changeset is a heads
 heads(set) -> members of set with no children in set
 keyword(string) 
 limit(set, n) -> first n members of set
 max(set) -> highest revision in set
 merge() -> cset is a merge
 modifies(pattern)
 outgoing([path])
 p1(set)
 p2(set)
 parents(set)
 removes(pattern)
 reverse(set)
 roots(set)
 sort(set[, spec])
 tagged()  changeset is tagged
 user(string)
 
Command line equivalents:

 -f -> ::.
 -d -> date(x)
 -k -> keyword(x)
 -m -> merge()
 -u -> user(x)
 -b -> branch(x)
 -P -> !::x
 -l -> limit(expr, x)


-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list