Patchwork [1,of,2] revset: document the `revset(...)` syntax

login
register
mail settings
Submitter Boris Feld
Date Oct. 16, 2018, 10:09 a.m.
Message ID <16ae7c19c2a2bb89ad4d.1539684541@localhost.localdomain>
Download mbox | patch
Permalink /patch/36035/
State Accepted
Headers show

Comments

Boris Feld - Oct. 16, 2018, 10:09 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1539220433 -7200
#      Thu Oct 11 03:13:53 2018 +0200
# Node ID 16ae7c19c2a2bb89ad4d201630cd87f6c635b7e0
# Parent  a66594c5fad422499bfaf669d182e02fe3c0be32
# EXP-Topic revset-doc
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 16ae7c19c2a2
revset: document the `revset(...)` syntax

We introduce a new "no-op" function to bear the documentation. In practice, the
parsing step is skipping it so it is not even called. This will get fixed in
the next changeset.
Yuya Nishihara - Oct. 16, 2018, 10:30 a.m.
On Tue, 16 Oct 2018 12:09:01 +0200, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1539220433 -7200
> #      Thu Oct 11 03:13:53 2018 +0200
> # Node ID 16ae7c19c2a2bb89ad4d201630cd87f6c635b7e0
> # Parent  a66594c5fad422499bfaf669d182e02fe3c0be32
> # EXP-Topic revset-doc
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 16ae7c19c2a2
> revset: document the `revset(...)` syntax

Queued, thanks.

> +@predicate('revset(set)', safe=True, takeorder=True)
> +def revsetpredicate(repo, subset, x, order):
> +    """Strictly interpret the content as a revset.
> +
> +    The content of this special predicate will be strictly interpreted as a
> +    revset. For example ``revset(id(0))`` will interpret "id(0)" without
> +    possible ambiguity with a possible "id(0)" bookmark or tag.

I've removed one of these "possible"s, and done minor tweaks.

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -1751,6 +1751,16 @@  def rev(repo, subset, x):
         return baseset()
     return subset & baseset([l])
 
+@predicate('revset(set)', safe=True, takeorder=True)
+def revsetpredicate(repo, subset, x, order):
+    """Strictly interpret the content as a revset.
+
+    The content of this special predicate will be strictly interpreted as a
+    revset. For example ``revset(id(0))`` will interpret "id(0)" without
+    possible ambiguity with a possible "id(0)" bookmark or tag.
+    """
+    return getset(repo, subset, x, order)
+
 @predicate('matching(revision [, field])', safe=True)
 def matching(repo, subset, x):
     """Changesets in which a given set of fields match the set of fields in the