Patchwork [09,of,10,RFC] templatekw: add labels to getfiles

login
register
mail settings
Submitter Sean Farley
Date Dec. 21, 2012, 5:37 a.m.
Message ID <4916048729c65cd1c5d4.1356068279@laptop.local>
Download mbox | patch
Permalink /patch/244/
State Superseded
Headers show

Comments

Sean Farley - Dec. 21, 2012, 5:37 a.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1356046498 21600
# Node ID 4916048729c65cd1c5d433153c054c2dd1b2becc
# Parent  17ff3c6ffb3fb21e6431fc01626ba29e1e448a1b
templatekw: add labels to getfiles

Adds label data to each array of modifiend, added, or removed files

Patch

diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -101,11 +101,17 @@ 
         yield templ(endname, **args)
 
 def getfiles(repo, ctx, revcache):
     if 'files' not in revcache:
         revcache['files'] = repo.status(ctx.p1().node(), ctx.node())[:3]
-    return revcache['files']
+
+    f = revcache['files']
+    m = [labelify(x, 'status.modified') for x in f[0]]
+    a = [labelify(x, 'status.added') for x in f[1]]
+    r = [labelify(x, 'status.removed') for x in f[2]]
+    return [m, a, r]
+
 
 def getlatesttags(repo, ctx, cache):
     '''return date, distance and name for the latest tag of rev'''
 
     if 'latesttags' not in cache: