On Thu, 11 Jan 2018 11:13:57 -0500, Matt Harbison <mharbiso...@gmail.com>
wrote:
On Jan 11, 2018, at 10:16 AM, Yuya Nishihara <y...@tcha.org> wrote:
On Thu, 11 Jan 2018 00:17:39 -0500, Matt Harbison wrote:
# HG changeset patch
# User Matt Harbison <matt_harbi...@yahoo.com>
# Date 1515641014 18000
# Wed Jan 10 22:23:34 2018 -0500
# Node ID 548e748cb3f4eea0aedb36a2b2e9fe3b77ffb263
# Parent 962b2bdd70d094ce4bf9a8135495788166b04510
filterlang: add a small language to filter files
Finally, I changed the extension operator from '.' to '*'. This
matches how git
tracks by extension, but might be slightly confusing here because '**'
recurses
in Mercurial, but '*' usually doesn't.
I prefer '**' or 'relglob:*' for fileset compatibility.
Good idea.
+ elif op == '/': # directory or full path test
+ p = name[1:].rstrip('/') # prefix
+ pl = len(p)
+ f = lambda n, s: n.startswith(p) and (len(n) == pl or
n[pl] == '/')
+ return f
Perhaps this could be 'path:'.
Good idea.
I ended up needing to add this to avoid a parse error. The "*fileset*"
tests run, but I'm not sure if this should be allowed for normal
filesets. The '/' operator works because it is in the globchars string.
diff --git a/mercurial/fileset.py b/mercurial/fileset.py
--- a/mercurial/fileset.py
+++ b/mercurial/fileset.py
@@ -72,13 +72,13 @@
pos += 1
else:
raise error.ParseError(_("unterminated string"), s)
- elif c.isalnum() or c in globchars or ord(c) > 127:
+ elif c.isalnum() or c in globchars or ord(c) > 127 or c == ':':
# gather up a symbol/keyword
s = pos
pos += 1
while pos < l: # find end of symbol
d = program[pos]
- if not (d.isalnum() or d in globchars or ord(d) > 127):
+ if not (d.isalnum() or d in globchars or ord(d) > 127 or
d == ':'):
break
pos += 1
sym = program[s:pos]
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel