[PATCH 10 of 10 RFC] templatekw: complicated logic to add labels to {files}
Sean Farley
sean.michael.farley at gmail.com
Thu Dec 20 23:38:00 CST 2012
# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# 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/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -287,11 +287,18 @@
def showfiles(**args):
""":files: List of strings. All files modified, added, or removed by this
changeset.
"""
- 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
changeset.
"""
More information about the Mercurial-devel
mailing list