[PATCH 1 of 3] fileset: use fctx.isbinary instead of util.binary(fctx.data())

Jun Wu quark at fb.com
Thu May 4 01:19:34 UTC 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1493859720 25200
#      Wed May 03 18:02:00 2017 -0700
# Node ID 7bfa6bc376e3dd504276e324545913af511cf4a6
# Parent  efcaf6ab86f40b8cc6fbb0e28764d9c1e88dfb27
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 7bfa6bc376e3
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.

diff --git a/mercurial/fileset.py b/mercurial/fileset.py
--- a/mercurial/fileset.py
+++ b/mercurial/fileset.py
@@ -257,5 +257,5 @@ def binary(mctx, x):
     # 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)


More information about the Mercurial-devel mailing list