[PATCH 2 of 2 V2] fileset: don't suggest private or undocumented queries

Matt Harbison mharbison72 at gmail.com
Sat Jun 20 12:33:39 CDT 2015


# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1434812856 14400
#      Sat Jun 20 11:07:36 2015 -0400
# Node ID 4359485eb420d7474c22e492dcf6d9596f50fc9a
# Parent  256e585109c1dfd6b94e56c4bf2255a398917b54
fileset: don't suggest private or undocumented queries

Unlike revsets, it looks like all of the filesets are documented, so there's
really nothing to test.  This is aimed more at parity with revsets and
future-proofing.

diff --git a/mercurial/fileset.py b/mercurial/fileset.py
--- a/mercurial/fileset.py
+++ b/mercurial/fileset.py
@@ -189,7 +189,11 @@
 def func(mctx, a, b):
     if a[0] == 'symbol' and a[1] in symbols:
         return symbols[a[1]](mctx, b)
-    raise error.UnknownIdentifier(a[1], symbols.keys())
+
+    keep = lambda fn: getattr(fn, '__doc__', None) is not None
+
+    syms = [s for (s, fn) in symbols.items() if keep(fn)]
+    raise error.UnknownIdentifier(a[1], syms)
 
 def getlist(x):
     if not x:


More information about the Mercurial-devel mailing list