Patchwork [5,of,8] files: add support for log-like template keywords and functions

login
register
mail settings
Submitter Yuya Nishihara
Date July 3, 2018, 1:26 p.m.
Message ID <28b59a68d834e996fb00.1530624368@mimosa>
Download mbox | patch
Permalink /patch/32584/
State Accepted
Headers show

Comments

Yuya Nishihara - July 3, 2018, 1:26 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1530450080 -32400
#      Sun Jul 01 22:01:20 2018 +0900
# Node ID 28b59a68d834e996fb00fafcae48f7bf7d5226bc
# Parent  9afe500ac808e74f2d1535ffc44d089b7cd729e5
files: add support for log-like template keywords and functions

Note that the ctx does not point to the revision where the file was
last changed, but the revision specified by -rREV option.

Patch

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -2144,6 +2144,7 @@  def files(ui, ctx, m, fm, fmt, subrepos)
     needsfctx = ui.verbose or {'size', 'flags'} & fm.datahint()
     for f in ctx.matches(m):
         fm.startitem()
+        fm.context(ctx=ctx)
         if needsfctx:
             fc = ctx[f]
             fm.write('size flags', '% 10d % 1s ', fc.size(), fc.flags())
diff --git a/tests/test-manifest.t b/tests/test-manifest.t
--- a/tests/test-manifest.t
+++ b/tests/test-manifest.t
@@ -41,6 +41,10 @@  The next call is expected to return noth
   a 2 
   b/a 2 x
   l 1 l
+  $ hg files -T '{path} {node|shortest}\n' -r.
+  a 5bdc
+  b/a 5bdc
+  l 5bdc
 
   $ hg manifest -v
   644   a