Patchwork D3976: grep: add MULTIREV support to --allfiles flag

login
register
mail settings
Submitter phabricator
Date Aug. 7, 2018, 2:52 p.m.
Message ID <a26df4433cd4532bc45626e14150baa0@localhost.localdomain>
Download mbox | patch
Permalink /patch/33407/
State Not Applicable
Headers show

Comments

phabricator - Aug. 7, 2018, 2:52 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGf3f109971359: grep: add MULTIREV support to --allfiles flag (authored by sangeet259, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3976?vs=10059&id=10060

REVISION DETAIL
  https://phab.mercurial-scm.org/D3976

AFFECTED FILES
  mercurial/cmdutil.py
  mercurial/commands.py
  tests/test-grep.t

CHANGE DETAILS




To: sangeet259, #hg-reviewers
Cc: yuja, mercurial-devel

Patch

diff --git a/tests/test-grep.t b/tests/test-grep.t
--- a/tests/test-grep.t
+++ b/tests/test-grep.t
@@ -491,3 +491,13 @@ 
   ]
 
   $ cd ..
+
+test -rMULTIREV with --all-files
+
+  $ cd sng
+  $ hg rm um
+  $ hg commit -m "deletes um"
+  $ hg grep -r "0:2" "unmod" --all-files
+  um:0:unmod
+  um:1:unmod
+  $ cd ..
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2533,6 +2533,7 @@ 
     """
     opts = pycompat.byteskwargs(opts)
     diff = opts.get('all') or opts.get('diff')
+    all_files = opts.get('all_files')
     if diff and opts.get('all_files'):
         raise error.Abort(_('--diff and --all-files are mutually exclusive'))
     # TODO: remove "not opts.get('rev')" if --all-files -rMULTIREV gets working
@@ -2757,7 +2758,7 @@ 
             if pstates or states:
                 r = display(fm, fn, ctx, pstates, states)
                 found = found or r
-                if r and not diff:
+                if r and not diff and not all_files:
                     skip[fn] = True
                     if copy:
                         skip[copy] = True
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -1889,9 +1889,6 @@ 
     revs = _walkrevs(repo, opts)
     if not revs:
         return []
-    if allfiles and len(revs) > 1:
-        raise error.Abort(_("multiple revisions not supported with "
-                            "--all-files"))
     wanted = set()
     slowpath = match.anypats() or (not match.always() and opts.get('removed'))
     fncache = {}