Patchwork [10,of,10,RFC] templatekw: complicated logic to add labels to {files}

mail settings
Submitter Sean Farley
Date Dec. 21, 2012, 5:38 a.m.
Message ID <c5e717603a8e79c0ced7.1356068280@laptop.local>
Download mbox | patch
Permalink /patch/243/
State Superseded
Headers show


Sean Farley - Dec. 21, 2012, 5:38 a.m.
# HG changeset patch
# User Sean Farley <sean.michael.farley at>
# Date 1356046588 21600
# Node ID c5e717603a8e79c0ced7599f6f7c8137a081deba
# Parent  4916048729c65cd1c5d433153c054c2dd1b2becc
templatekw: complicated logic to add labels to {files}

Another 'gotcha'. It turns out ctx.files() is different from getfiles(). I would probably understand had I more mercurial experience but this is my first big endeavor into the codebase and could use some guidance for issues like these.


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -287,11 +287,18 @@ 
 def showfiles(**args):
     """:files: List of strings. All files modified, added, or removed by this
-    return showlist('file', args['ctx'].files(), **args)
+    repo, ctx, revcache = args['repo'], args['ctx'], args['revcache']
+    files = getfiles(repo, ctx, revcache) # isn't the same as ctx.files()?
+    files = sorted(files[0] + files[1] + files[2], key=lambda f: f['data'])
+    files = [f for f in files if f['data'] in ctx.files()]
+    return showlist('file', files, **args)
 def showlatesttag(repo, ctx, templ, cache, **args):
     """:latesttag: String. Most recent global tag in the ancestors of this