[PATCH 1 of 1] grep: don't print data from binary files for matches (issue2614)

Matt Mackall mpm at selenic.com
Sat Apr 9 15:14:11 CDT 2011


On Sat, 2011-04-09 at 23:40 +0530, Md. O. Shayan wrote:
> # HG changeset patch
> # User Md. O. Shayan <mdoshayan at gmail.com>
> # Date 1302370997 -19800
> # Node ID 19915a1586f506dbe82be60b390f37ff96723b8b
> # Parent  6cbe250742aac8668aa24afce0bf614c7c1cdc78
> grep: don't print data from binary files for matches (issue2614)

Still didn't run all the tests:

--- /export/p4-matt/hg-test/tests/test-debugcomplete.t 
+++ /export/p4-matt/hg-test/tests/test-debugcomplete.t.err 
@@ -235,7 +235,7 @@
   debugsub: rev
   debugwalk: include, exclude
   debugwireargs: three, four, ssh, remotecmd, insecure
-  grep: print0, all, follow, ignore-case, files-with-matches,
line-number, rev, user, date, include, exclude
+  grep: print0, all, text, follow, ignore-case, files-with-matches,
line-number, rev, user, date, include, exclude
   heads: rev, topo, active, closed, style, template
   help: 
   identify: rev, num, id, branch, tags, bookmarks


> diff -r 6cbe250742aa -r 19915a1586f5 tests/test-grep-bin.t
> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/tests/test-grep-bin.t	Sat Apr 09 23:13:17 2011 +0530
> @@ -0,0 +1,7 @@
> +  $ hg init a
> +  $ cd a
> +  $ cp $TESTDIR/binfile.bin .
> +  $ hg add binfile.bin
> +  $ hg ci -m 'add binfile.bin'
> +  $ hg grep "MaCam" --all
> +  binfile.bin:0:+: Binary file matches

Please don't add new tests. Add -minimal- test cases to existing tests.
There's already a grep test, so you just need to add a couple lines to
it.

Note the irony here: you probably didn't run all the tests because the
test suite is slow. And the test suite is slow because people keep
adding new, non-minimal tests.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list