D7000: grep: enable all-files by default (BC)

JordiGH (Jordi GutiƩrrez Hermoso) phabricator at mercurial-scm.org
Fri Oct 18 11:40:32 EDT 2019


JordiGH added a comment.


  Wait, I found some problems, here is an amendment:
  
    # HG changeset patch
    # User Jordi GutiƩrrez Hermoso <jordigh at octave.org>
    # Date 1571411921 14400
    #      Fri Oct 18 11:18:41 2019 -0400
    # Node ID 60eb1feadbeebd2ddab16e0d1b4566dbf216333c
    # Parent  8c0fe77f47c5956681238b79dc15093c92e79395
    grep: update docs to reflect new --all-files default
    
    These docs no longer even mention the old weird behaviour that was
    poorly understood and underutilised. I think this undocumentation
    effectively deprecates it.
    
    diff --git a/mercurial/commands.py b/mercurial/commands.py
    --- a/mercurial/commands.py
    +++ b/mercurial/commands.py
    @@ -3276,7 +3276,7 @@ statemod.addunfinished(
                 b'diff',
                 None,
                 _(
    -                b'print all revisions when the term was introduced '
    +                b'search revision differences for when the pattern was added '
                     b'or removed'
                 ),
             ),
    @@ -3302,7 +3302,7 @@ statemod.addunfinished(
                 b'r',
                 b'rev',
                 [],
    -            _(b'only search files changed within revision range'),
    +            _(b'search files changed within revision range'),
                 _(b'REV'),
             ),
             (
    @@ -3324,23 +3324,27 @@ statemod.addunfinished(
         intents={INTENT_READONLY},
     )
     def grep(ui, repo, pattern, *pats, **opts):
    -    """search revision history for a pattern in specified files
    -
    -    Search revision history for a regular expression in the specified
    -    files or the entire project.
    -
    -    By default, grep prints the most recent revision number for each
    -    file in which it finds a match. To get it to print every revision
    -    that contains a change in match status ("-" for a match that becomes
    -    a non-match, or "+" for a non-match that becomes a match), use the
    -    --diff flag.
    +    """search for a pattern in specified files
    +
    +    Search the working directory or revision history for a regular
    +    expression in the specified files for the entire project.
    +
    +    By default, grep searches the repository files in the working
    +    directory and prints the files where it finds a match. To specify
    +    historical revisions instead of the working directory, use the
    +    --rev flag.
    +
    +    To search instead historical revision differences that contains a
    +    change in match status ("-" for a match that becomes a non-match,
    +    or "+" for a non-match that becomes a match), use the --diff flag.
     
         PATTERN can be any Python (roughly Perl-compatible) regular
         expression.
     
    -    If no FILEs are specified (and -f/--follow isn't set), all files in
    -    the repository are searched, including those that don't exist in the
    -    current branch or have been deleted in a prior changeset.
    +    If no FILEs are specified and the --rev flag isn't supplied, all
    +    files in the working directory are searched. When using the --rev
    +    flag and specifying FILEs, use the --follow argument to also
    +    follow the specified FILEs across renames and copies.
     
         .. container:: verbose
     
    @@ -3363,6 +3367,7 @@ def grep(ui, repo, pattern, *pats, **opt
           See :hg:`help templates.operators` for the list expansion syntax.
     
         Returns 0 if a match is found, 1 otherwise.
    +
         """
         opts = pycompat.byteskwargs(opts)
         diff = opts.get(b'all') or opts.get(b'diff')

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7000/new/

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

To: khanchi97, #hg-reviewers
Cc: JordiGH, mercurial-devel


More information about the Mercurial-devel mailing list