diff mercurial/templatekw.py @ 39395:5b1d406b39f1

templatekw: alias {name} of file copies dict to {path} For the same reason as the previous patch. We might want some hack to support {source.path}, {source.rev}, etc., but that's a different issue.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 05 Aug 2018 16:27:09 +0900
parents 83f8f7b9fa60
children 3cd977d5a16b
line wrap: on
line diff
--- a/mercurial/templatekw.py	Sun Aug 05 16:14:18 2018 +0900
+++ b/mercurial/templatekw.py	Sun Aug 05 16:27:09 2018 +0900
@@ -323,11 +323,8 @@
             rename = getrenamed(fn, ctx.rev())
             if rename:
                 copies.append((fn, rename))
-
-    copies = util.sortdict(copies)
-    return compatdict(context, mapping, 'file_copy', copies,
-                      key='name', value='source', fmt='%s (%s)',
-                      plural='file_copies')
+    return templateutil.compatfilecopiesdict(context, mapping, 'file_copy',
+                                             copies)
 
 # showfilecopiesswitch() displays file copies only if copy records are
 # provided before calling the templater, usually with a --copies
@@ -338,10 +335,8 @@
     only if the --copied switch is set.
     """
     copies = context.resource(mapping, 'revcache').get('copies') or []
-    copies = util.sortdict(copies)
-    return compatdict(context, mapping, 'file_copy', copies,
-                      key='name', value='source', fmt='%s (%s)',
-                      plural='file_copies')
+    return templateutil.compatfilecopiesdict(context, mapping, 'file_copy',
+                                             copies)
 
 @templatekeyword('file_dels', requires={'ctx', 'revcache'})
 def showfiledels(context, mapping):