Patchwork [3,of,4] templatekw: add option to include ignored/clean/unknown files in cache

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 13, 2018, 2:10 p.m.
Message ID <8d875b086b8c80c7c804.1536847830@mimosa>
Download mbox | patch
Permalink /patch/34602/
State Accepted
Headers show

Comments

Yuya Nishihara - Sept. 13, 2018, 2:10 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1532868721 -32400
#      Sun Jul 29 21:52:01 2018 +0900
# Node ID 8d875b086b8c80c7c8047b0700cd05e2520c1971
# Parent  4b894ac398b708df9c2f4e7b8715bd4be1617342
templatekw: add option to include ignored/clean/unknown files in cache

They will be necessary to provide {status} of files.

Patch

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -291,11 +291,14 @@  def showextras(context, mapping):
     return _hybrid(f, extras, makemap,
                    lambda k: '%s=%s' % (k, stringutil.escapestr(extras[k])))
 
-def _getfilestatus(context, mapping):
+def _getfilestatus(context, mapping, listall=False):
     ctx = context.resource(mapping, 'ctx')
     revcache = context.resource(mapping, 'revcache')
-    if 'filestatus' not in revcache:
-        revcache['filestatus'] = ctx.p1().status(ctx)
+    if 'filestatus' not in revcache or revcache['filestatusall'] < listall:
+        stat = ctx.p1().status(ctx, listignored=listall, listclean=listall,
+                               listunknown=listall)
+        revcache['filestatus'] = stat
+        revcache['filestatusall'] = listall
     return revcache['filestatus']
 
 def _showfilesbystat(context, mapping, name, index):