diff mercurial/fileset.py @ 24408:caa6b6c65dc3

fileset: add a fileset for portable filenames This has mostly the same semantics as the files that the 'ui.portablefilenames' config option would warn or abort about. The only difference is filenames that case-fold to the same string -- given a set of filenames we've already checked we can check whether a new one collides with them, but we don't have a way to tell which filename it collided with.
author Siddharth Agarwal <sid0@fb.com>
date Thu, 19 Mar 2015 21:26:18 -0700
parents eda2f36889b5
children ac381dd7a21f
line wrap: on
line diff
--- a/mercurial/fileset.py	Mon Mar 16 16:01:16 2015 -0700
+++ b/mercurial/fileset.py	Thu Mar 19 21:26:18 2015 -0700
@@ -256,6 +256,16 @@
     ignore = mctx.ctx.repo().dirstate._ignore
     return [f for f in mctx.subset if ignore(f)]
 
+def portable(mctx, x):
+    """``portable()``
+    File that has a portable name. (This doesn't include filenames with case
+    collisions.)
+    """
+    # i18n: "portable" is a keyword
+    getargs(x, 0, 0, _("portable takes no arguments"))
+    checkwinfilename = util.checkwinfilename
+    return [f for f in mctx.subset if checkwinfilename(f) is None]
+
 def grep(mctx, x):
     """``grep(regex)``
     File contains the given regular expression.
@@ -416,6 +426,7 @@
     'ignored': ignored,
     'hgignore': hgignore,
     'modified': modified,
+    'portable': portable,
     'removed': removed,
     'resolved': resolved,
     'size': size,