Patchwork [STABLE] minifileset: note the unsupported file pattern when raising a parse error

login
register
mail settings
Submitter Matt Harbison
Date Jan. 25, 2018, 3:39 a.m.
Message ID <e35003f9f45083db11b7.1516851571@Envy>
Download mbox | patch
Permalink /patch/27058/
State Accepted
Headers show

Comments

Matt Harbison - Jan. 25, 2018, 3:39 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1516850788 18000
#      Wed Jan 24 22:26:28 2018 -0500
# Branch stable
# Node ID e35003f9f45083db11b72e28aab99c5f0e5676bb
# Parent  b91bca85ba73c5a755a9e4ae44aaeb787ee3fae2
minifileset: note the unsupported file pattern when raising a parse error

This was useful in debugging, because I stupidly quoted it out of habit from the
command line.  This isn't a great example that clearly shows the problem, but I
don't know how to improve it.  The problem *is* obvious once a complex statement
or a clearly bogus string is used.
Yuya Nishihara - Jan. 25, 2018, 11:44 a.m.
On Wed, 24 Jan 2018 22:39:31 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1516850788 18000
> #      Wed Jan 24 22:26:28 2018 -0500
> # Branch stable
> # Node ID e35003f9f45083db11b72e28aab99c5f0e5676bb
> # Parent  b91bca85ba73c5a755a9e4ae44aaeb787ee3fae2
> minifileset: note the unsupported file pattern when raising a parse error

Simple enough for stable. Queued, thanks.

Patch

diff --git a/mercurial/minifileset.py b/mercurial/minifileset.py
--- a/mercurial/minifileset.py
+++ b/mercurial/minifileset.py
@@ -30,7 +30,7 @@ 
             pl = len(p)
             f = lambda n, s: n.startswith(p) and (len(n) == pl or n[pl] == '/')
             return f
-        raise error.ParseError(_("unsupported file pattern"),
+        raise error.ParseError(_("unsupported file pattern: %s") % name,
                                hint=_('paths must be prefixed with "path:"'))
     elif op == 'or':
         func1 = _compile(tree[1])
diff --git a/tests/test-lfs.t b/tests/test-lfs.t
--- a/tests/test-lfs.t
+++ b/tests/test-lfs.t
@@ -18,6 +18,10 @@ 
 # Commit small file
   $ echo s > smallfile
   $ echo '**.py = LF' > .hgeol
+  $ hg --config lfs.track='"size(\">1000B\")"' commit -Aqm "add small file"
+  hg: parse error: unsupported file pattern: size(">1000B")
+  (paths must be prefixed with "path:")
+  [255]
   $ hg --config lfs.track='size(">1000B")' commit -Aqm "add small file"
 
 # Commit large file