D2938: grep: make grep search on working directory by default

av6 (Anton Shestakov) phabricator at mercurial-scm.org
Sat Mar 24 08:07:34 EDT 2018


av6 added inline comments.

INLINE COMMENTS

> commands.py:2485
> +            fm.data(node=fm.hexfunc(scmutil.binnode(ctx)))
> +            if not bool(opts.get('all')) and not bool(opts.get('rev')):
> +                cols = [

This line looks identical to the one later on, with Pulkit's comment about usage of bool().

> commands.py:2487-2490
>                  ('filename', fn, True),
> -                ('rev', rev, True),
> +                ('rev', rev, False),
>                  ('linenumber', l.linenum, opts.get('line_number')),
>              ]

This block is not indented enough, but see my other comment below.

> commands.py:2494
> +                    ('filename', fn, True),
> +                    ('rev', rev, True),
> +                    ('linenumber', l.linenum, opts.get('line_number')),

Since the difference in both branches for this if-else block seems to be only in this line, and just one value, it probably makes sense to store said value in a variable and use it in place of False/True and reduce duplication.

REPOSITORY
  rHG Mercurial

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

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


More information about the Mercurial-devel mailing list