diff mercurial/commands.py @ 38653:aabc01da9834

grep: hide cryptic revision number by default I believe nobody would want to see the "2147483647:" prefix while grepping working directory files. The wdir revision is still visible if "-r wdir()" is specified since a revset may point to more than one revisions, and it seems confusing to change the visibility dynamically by the number of the matched revisions. Differential Revision: https://phab.mercurial-scm.org/D3920
author Yuya Nishihara <yuya@tcha.org>
date Tue, 10 Jul 2018 22:55:30 +0900
parents bfcd5c7cbf9a
children e7aa113b14f7
line wrap: on
line diff
--- a/mercurial/commands.py	Wed Jul 11 22:06:04 2018 +0900
+++ b/mercurial/commands.py	Tue Jul 10 22:55:30 2018 +0900
@@ -2538,7 +2538,8 @@
     if opts.get('all_files') is None and not opts.get('rev') and not diff:
         # experimental config: commands.grep.all-files
         opts['all_files'] = ui.configbool('commands', 'grep.all-files')
-    if opts.get('all_files') and not opts.get('rev'):
+    plaingrep = opts.get('all_files') and not opts.get('rev')
+    if plaingrep:
         opts['rev'] = ['wdir()']
 
     reflags = re.M
@@ -2648,7 +2649,7 @@
 
             cols = [
                 ('filename', fn, True),
-                ('rev', rev, True),
+                ('rev', rev, not plaingrep),
                 ('linenumber', l.linenum, opts.get('line_number')),
             ]
             if diff: