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

login
register
mail settings
Submitter Jun Wu
Date May 4, 2017, 1:19 a.m.
Message ID <7bfa6bc376e3dd504276.1493860774@x1c>
Download mbox | patch
Permalink /patch/20413/
State Accepted
Headers show

Comments

Jun Wu - May 4, 2017, 1:19 a.m.
# HG changeset patch
# User Jun Wu <quark@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.
Yuya Nishihara - May 4, 2017, 3:56 a.m.
On Wed, 3 May 2017 18:19:34 -0700, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark@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())

Seems fine, queued, thanks.

Patch

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)