Patchwork D5777: grep: respect ui.relative-paths

login
register
mail settings
Submitter phabricator
Date Feb. 2, 2019, 2:11 a.m.
Message ID <68b1014fec9a27f1359f5d493f41e666@localhost.localdomain>
Download mbox | patch
Permalink /patch/38318/
State Not Applicable
Headers show

Comments

phabricator - Feb. 2, 2019, 2:11 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG42c0d9b1927a: grep: respect ui.relative-paths (authored by martinvonz, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D5777?vs=13664&id=13694#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5777?vs=13664&id=13694

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

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

CHANGE DETAILS




To: martinvonz, #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
@@ -32,6 +32,20 @@ 
   port:4:vaportight
   port:4:import/export
 
+simple from subdirectory
+
+  $ mkdir dir
+  $ cd dir
+  $ hg grep -r tip:0 port
+  port:4:export
+  port:4:vaportight
+  port:4:import/export
+  $ hg grep -r tip:0 port --config ui.relative-paths=yes
+  ../port:4:export
+  ../port:4:vaportight
+  ../port:4:import/export
+  $ cd ..
+
 simple with color
 
   $ hg --config extensions.color= grep --config color.mode=ansi \
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2848,6 +2848,7 @@ 
                 for i in pycompat.xrange(blo, bhi):
                     yield ('+', b[i])
 
+    uipathfn = scmutil.getuipathfn(repo)
     def display(fm, fn, ctx, pstates, states):
         rev = scmutil.intrev(ctx)
         if fm.isplain():
@@ -2875,8 +2876,8 @@ 
         for change, l in iter:
             fm.startitem()
             fm.context(ctx=ctx)
-            fm.data(node=fm.hexfunc(scmutil.binnode(ctx)))
-            fm.write('path', '%s', fn, label='grep.filename')
+            fm.data(node=fm.hexfunc(scmutil.binnode(ctx)), path=fn)
+            fm.plain(uipathfn(fn), label='grep.filename')
 
             cols = [
                 ('rev', '%d', rev, not plaingrep),