Patchwork [4,of,9] templatekw: inline getfiles()

login
register
mail settings
Submitter Yuya Nishihara
Date Feb. 27, 2018, 2:57 p.m.
Message ID <6b3af7c365816188dea9.1519743477@mimosa>
Download mbox | patch
Permalink /patch/28462/
State New
Headers show

Comments

Yuya Nishihara - Feb. 27, 2018, 2:57 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1519544198 -32400
#      Sun Feb 25 16:36:38 2018 +0900
# Node ID 6b3af7c365816188dea95c2a10b0ddcb50f818b8
# Parent  e0a72c36b24883cf6dd62144e9b2ca7959fb8b23
templatekw: inline getfiles()

It's just three lines. We don't need a separate function for that.

Patch

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -216,11 +216,6 @@  def _showlist(name, values, mapping, plu
     if endname in templ:
         yield templ(endname, **strmapping)
 
-def getfiles(repo, ctx, revcache):
-    if 'files' not in revcache:
-        revcache['files'] = repo.status(ctx.p1(), ctx)[:3]
-    return revcache['files']
-
 def getlatesttags(repo, ctx, cache, pattern=None):
     '''return date, distance and name for the latest tag of rev'''
 
@@ -466,7 +461,9 @@  def showextras(**args):
 
 def _showfilesbystat(args, name, index):
     repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
-    files = getfiles(repo, ctx, revcache)[index]
+    if 'files' not in revcache:
+        revcache['files'] = repo.status(ctx.p1(), ctx)[:3]
+    files = revcache['files'][index]
     return showlist(name, files, args, element='file')
 
 @templatekeyword('file_adds')