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

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


JordiGH added a comment.


  In D7000#103065 <https://phab.mercurial-scm.org/D7000#103065>, @khanchi97 wrote:
  
  > Sure :)
  
  How about something like this?
  
    # 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 86cafc9dec2660561f65ec17d043f3117767a9a8
    # 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 commit differences for when the term 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,16 +3324,19 @@ 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 or 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.

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