changeset 27459:2f15253e415f

fileset: treat encoding and eol as the predicate calling _existing Before this patch, predicate function 'encoding' and 'eol' aren't listed up in '_existingcallers', even though they invoke 'existing()'. This causes unexpected failure of these predicate, if there is a (manually) deleted file in the working directory. 8a0513bf030a and 3ce3f2b059a1 seem to overlook putting already existing 'encoding' or newly introduced 'eol' into '_existingcallers'. This patch also changes order of fileset "eol(unix)" output in test, because "existing caller" predicates show "A(dded)" files before "C(lean)" ones.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Mon, 21 Dec 2015 22:31:16 +0900
parents d39e743e3578
children 11286ac374f3
files mercurial/fileset.py tests/test-fileset.t
diffstat 2 files changed, 22 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/fileset.py	Fri Dec 18 18:32:15 2015 +0000
+++ b/mercurial/fileset.py	Mon Dec 21 22:31:16 2015 +0900
@@ -510,6 +510,8 @@
 # filesets using matchctx.existing()
 _existingcallers = [
     'binary',
+    'encoding',
+    'eol',
     'exec',
     'grep',
     'size',
--- a/tests/test-fileset.t	Fri Dec 18 18:32:15 2015 +0000
+++ b/tests/test-fileset.t	Mon Dec 21 22:31:16 2015 +0900
@@ -297,16 +297,34 @@
   >>> open('mac', 'wb').write("mac\r")
   $ hg add dos mixed mac
 
+(remove a1, to examine safety of 'eol' on removed files)
+  $ rm a1
+
   $ fileset 'eol(dos)'
   dos
   mixed
   $ fileset 'eol(unix)'
+  mixed
   .hgsub
   .hgsubstate
-  a1
   b1
   b2
   c1
-  mixed
   $ fileset 'eol(mac)'
   mac
+
+Test safety of 'encoding' on removed files
+
+  $ fileset 'encoding("ascii")'
+  dos
+  mac
+  mixed
+  .hgsub
+  .hgsubstate
+  1k
+  2k
+  b1
+  b2
+  b2link
+  bin
+  c1