From patchwork Mon Mar 26 19:51:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D2943: grep: fixes errorneous output of grep in forward order From: phabricator X-Patchwork-Id: 29885 Message-Id: <8b72d50c268ed765630049349725b49b@localhost.localdomain> To: mercurial-devel@mercurial-scm.org Date: Mon, 26 Mar 2018 19:51:12 +0000 sangeet259 updated this revision to Diff 7321. sangeet259 edited the summary of this revision. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D2943?vs=7290&id=7321 REVISION DETAIL https://phab.mercurial-scm.org/D2943 AFFECTED FILES mercurial/commands.py tests/test-grep.t CHANGE DETAILS To: sangeet259, #hg-reviewers Cc: mercurial-devel diff --git a/tests/test-grep.t b/tests/test-grep.t --- a/tests/test-grep.t +++ b/tests/test-grep.t @@ -328,6 +328,18 @@ color:3:-:red color:1:+:red + +Issue3885: test that changing revision order does not alter the +revisions printed, just their order. + + $ hg grep --all red -r "all()" + color:1:+:red + color:3:-:red + + $ hg grep --all red -r "reverse(all())" + color:3:-:red + color:1:+:red + $ cd .. $ hg init a diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2610,8 +2610,9 @@ skip[fn] = True if copy: skip[copy] = True - del matches[rev] del revfiles[rev] + if not revfiles: + matches.clear() fm.end() return not found