[PATCH 1 of 2] test-grep: document that trivially moved lines might not be detected
Augie Fackler
raf at durin42.com
Wed Sep 9 18:50:28 UTC 2020
queued, thanks
> On Sep 9, 2020, at 08:20, Yuya Nishihara <yuya at tcha.org> wrote:
>
> # HG changeset patch
> # User Yuya Nishihara <yuya at tcha.org>
> # Date 1599568690 -32400
> # Tue Sep 08 21:38:10 2020 +0900
> # Node ID cc233fb2375feef75d3f9619ed69cd5d5dea89dd
> # Parent 89d2c8f8bb4f5bfda272d2665ebcacd98e273d25
> test-grep: document that trivially moved lines might not be detected
>
> I'm not going to fix this. I just learned "grep --diff" does clever thing
> than a simple grep(patch.diff(context=0)), and I think it's better to
> document how things work.
>
> diff --git a/tests/test-grep.t b/tests/test-grep.t
> --- a/tests/test-grep.t
> +++ b/tests/test-grep.t
> @@ -640,6 +640,49 @@ revisions printed, just their order.
>
> $ cd ..
>
> +Moved line may not be collected by "grep --diff" since it first filters
> +the contents to be diffed by the pattern. (i.e.
> +"diff <(grep pat a) <(grep pat b)", not "diff a b | grep pat".)
> +This is much faster than generating full diff per revision.
> +
> + $ hg init moved-line
> + $ cd moved-line
> + $ cat <<'EOF' > a
> + > foo
> + > bar
> + > baz
> + > EOF
> + $ hg ci -Am initial
> + adding a
> + $ cat <<'EOF' > a
> + > bar
> + > baz
> + > foo
> + > EOF
> + $ hg ci -m reorder
> +
> + $ hg diff -c 1
> + diff -r a593cc55e81b -r 69789a3b6e80 a
> + --- a/a Thu Jan 01 00:00:00 1970 +0000
> + +++ b/a Thu Jan 01 00:00:00 1970 +0000
> + @@ -1,3 +1,3 @@
> + -foo
> + bar
> + baz
> + +foo
> +
> + can't find the move of "foo" at the revision 1:
> +
> + $ hg grep --diff foo -r1
> + [1]
> +
> + "bar" isn't moved at the revisoin 1:
> +
> + $ hg grep --diff bar -r1
> + [1]
> +
> + $ cd ..
> +
> Test for showing working of allfiles flag
>
> $ hg init sng
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list