Please check out the revset feature

Cedric Duval cedricduval at free.fr
Mon Jun 7 15:34:27 CDT 2010


Matt Mackall wrote:
> 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())'

Very nice!

Giving it a try, I stumbled upon an issue while ending a specification
with '1.5::'. Something along the lines of the following patch might help.

# HG changeset patch
# User Cédric Duval <cedricduval at free.fr>
# Date 1275942295 -7200
# Node ID 1dcf7d358d91d828ded364d7fc8b47f6a86c6de1
# Parent  3d0591a661189bcb0a5e8ef3393c59ecd7e42f79
cmdutil: fix range determination when using a DAG separator

revset must be used with open DAG range specifications, otherwise
requesting eg. 'tag::' causes a range lookup between "tag" and ":",
which triggers an abandon.

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -13,6 +13,7 @@
 import similar, revset
 
 revrangesep = ':'
+dagrevrangesep = '::'
 
 def parsealiases(cmd):
     return cmd.lstrip("^").split("|")
@@ -149,8 +150,9 @@
 
     seen, l = set(), []
     for spec in revs:
-        if spec and not (
-            spec.startswith(revrangesep) or spec.endswith(revrangesep)):
+        if spec and (
+            spec.startswith(dagrevrangesep) or spec.endswith(dagrevrangesep) or
+             not (spec.startswith(revrangesep) or spec.endswith(revrangesep))):
             m = revset.match(spec)
             for r in m(repo, range(len(repo))):
                 if r not in seen:


More information about the Mercurial-devel mailing list