# HG changeset patch # User Yuya Nishihara # Date 2020-09-08 12:38:10 # Node ID 9c8d2cf7f59197531bf2926b4bc06d9f95c22d01 # Parent 9b9071fabcd3deef3575af7b913ba50fbb8f2c65 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