[PATCH] test-verify: add a testcase where the file has magic meta header

Ryan McElroy rm at fb.com
Thu Mar 30 05:02:34 EDT 2017


On 3/29/17 9:45 PM, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark at fb.com>
> # Date 1490820077 25200
> #      Wed Mar 29 13:41:17 2017 -0700
> # Node ID e9fda3b8614a8b701bd48041afa8b709e1227f27
> # Parent  cda83a1bfb3ac3a23cfa158c407be93755c1018e
> test-verify: add a testcase where the file has magic meta header
>
> We use a magic header "\1\n" to store metadata like renames. See filelog.py.
> The patch adds tests about files with the special header.

Sure, but why? Just to prevent regressions of handling files with this 
data that "looks like" metadata in them? What's the motivation for 
adding this test? Just future safety or did you run into something?

I'm not against it -- adding this test seems like a good idea, but I'd 
love more context on what led you to write it.

>
> diff --git a/tests/test-verify.t b/tests/test-verify.t
> --- a/tests/test-verify.t
> +++ b/tests/test-verify.t
> @@ -318,2 +318,18 @@ test revlog format 0
>     1 files, 1 changesets, 1 total revisions
>     $ cd ..
> +
> +Files with the meta header (see comment in filelog.size)
> +
> +  $ cat > $TESTTMP/writemeta.py <<EOF
> +  > import sys
> +  > with open(sys.argv[1], 'wb') as f:
> +  >     f.write(b'\x01\n\x01\n%s' % sys.argv[2])
> +  > EOF
> +
> +  $ hg init c
> +  $ cd c
> +  $ $PYTHON $TESTTMP/writemeta.py a ''
> +  $ $PYTHON $TESTTMP/writemeta.py b 'b'
> +  $ hg ci -Aqm meta a b
> +  $ hg verify -q
> +  $ cd ..
>



More information about the Mercurial-devel mailing list