fileset: use fctx.isbinary instead of util.binary(fctx.data())
authorJun Wu <quark@fb.com>
Wed, 03 May 2017 18:02:00 -0700
changeset 37240 4240be02df79f901b0bd4b249a1acb9f647694c8
parent 37239 435a3842ca3a5131f746bb8d2e910ac953fab08e
child 37241 347ab2d47463fce7a7ae17ee209fbb0e50e824e6
push id505
push usergszorc@mozilla.com
push dateMon, 08 May 2017 16:32:18 +0000
fileset: use fctx.isbinary instead of util.binary(fctx.data()) filectx provides "isbinary" to test if the data is binary. Let's use it. This enables other filectx implementations (like LFS) to override the isbinary test.
mercurial/fileset.py
--- a/mercurial/fileset.py
+++ b/mercurial/fileset.py
@@ -251,17 +251,17 @@ def getargs(x, min, max, err):
     return l
 
 @predicate('binary()', callexisting=True)
 def binary(mctx, x):
     """File that appears to be binary (contains NUL bytes).
     """
     # i18n: "binary" is a keyword
     getargs(x, 0, 0, _("binary takes no arguments"))
-    return [f for f in mctx.existing() if util.binary(mctx.ctx[f].data())]
+    return [f for f in mctx.existing() if mctx.ctx[f].isbinary()]
 
 @predicate('exec()', callexisting=True)
 def exec_(mctx, x):
     """File that is marked as executable.
     """
     # i18n: "exec" is a keyword
     getargs(x, 0, 0, _("exec takes no arguments"))
     return [f for f in mctx.existing() if mctx.ctx.flags(f) == 'x']