[PATCH] help: revsets

timeless timeless at gmail.com
Fri Jun 18 04:16:10 CDT 2010


This is just some basic documentation, which i think is better than nothing....

# HG changeset patch
# User timeless <timeless at gmail.com>
# Date 1276784499 -10800
# Node ID 91a51c8cc81407391143ca1a4899014c4df9c92c
# Parent  eab6f3e6d4d90cd0c6b5fe2819750e90dbc4734e
Revsets help

based on:
http://selenic.com/pipermail/mercurial-devel/2010-June/021638.html

diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -99,4 +99,5 @@ helptable = (
     (["extensions"], _("Using additional features"), extshelp),
     (["hgweb"], _("Configuring hgweb"), loaddoc('hgweb')),
     (["glossary"], _("Glossary"), loaddoc('glossary')),
+    (["revsets"], _("Rev Sets"), loaddoc('revsets')),
 )
diff --git a/mercurial/help/revsets.txt b/mercurial/help/revsets.txt
new file mode 100644
--- /dev/null
+++ b/mercurial/help/revsets.txt
@@ -0,0 +1,89 @@
+Revsets is a functional notation to select a set of revisions.
+
+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)                  changesets within the daterange
+  descendants(set)                 changesets which are decendants of
nodes in set
+  file(pattern)                    changesets which manually affected
files matching 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)                changesets which modify files
matching pattern
+  outgoing([path])
+  p1(set)                          first parent of nodes in set
+  p2(set)                          second parent of nodes in set
+  parents(set)                     each parent of nodes in set
+  removes(pattern)                 changesets which remove files
matching pattern
+  reverse(set)                     reverse order of set
+  roots(set)                       roots of nodes in set
+  sort(set[, spec])                sort set
+  tagged()                         changeset is tagged
+  user(string)                     user is 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)
+
+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())'
+


More information about the Mercurial-devel mailing list