##// END OF EJS Templates
templatekw: make {file_*} compare to both merge parents (issue4292)...
Martin von Zweigbergk -
r42982:0c72eddb default
parent child Browse files
Show More
@@ -290,11 +290,6 b' def _getfilestatusmap(context, mapping, '
290 statmap.update((f, char) for f in files)
290 statmap.update((f, char) for f in files)
291 return revcache['filestatusmap'] # {path: statchar}
291 return revcache['filestatusmap'] # {path: statchar}
292
292
293 def _showfilesbystat(context, mapping, name, index):
294 stat = _getfilestatus(context, mapping)
295 files = stat[index]
296 return templateutil.compatfileslist(context, mapping, name, files)
297
298 @templatekeyword('file_copies',
293 @templatekeyword('file_copies',
299 requires={'repo', 'ctx', 'cache', 'revcache'})
294 requires={'repo', 'ctx', 'cache', 'revcache'})
300 def showfilecopies(context, mapping):
295 def showfilecopies(context, mapping):
@@ -332,17 +327,23 b' def showfilecopiesswitch(context, mappin'
332 @templatekeyword('file_adds', requires={'ctx', 'revcache'})
327 @templatekeyword('file_adds', requires={'ctx', 'revcache'})
333 def showfileadds(context, mapping):
328 def showfileadds(context, mapping):
334 """List of strings. Files added by this changeset."""
329 """List of strings. Files added by this changeset."""
335 return _showfilesbystat(context, mapping, 'file_add', 1)
330 ctx = context.resource(mapping, 'ctx')
331 return templateutil.compatfileslist(context, mapping, 'file_add',
332 ctx.filesadded())
336
333
337 @templatekeyword('file_dels', requires={'ctx', 'revcache'})
334 @templatekeyword('file_dels', requires={'ctx', 'revcache'})
338 def showfiledels(context, mapping):
335 def showfiledels(context, mapping):
339 """List of strings. Files removed by this changeset."""
336 """List of strings. Files removed by this changeset."""
340 return _showfilesbystat(context, mapping, 'file_del', 2)
337 ctx = context.resource(mapping, 'ctx')
338 return templateutil.compatfileslist(context, mapping, 'file_del',
339 ctx.filesremoved())
341
340
342 @templatekeyword('file_mods', requires={'ctx', 'revcache'})
341 @templatekeyword('file_mods', requires={'ctx', 'revcache'})
343 def showfilemods(context, mapping):
342 def showfilemods(context, mapping):
344 """List of strings. Files modified by this changeset."""
343 """List of strings. Files modified by this changeset."""
345 return _showfilesbystat(context, mapping, 'file_mod', 0)
344 ctx = context.resource(mapping, 'ctx')
345 return templateutil.compatfileslist(context, mapping, 'file_mod',
346 ctx.filesmodified())
346
347
347 @templatekeyword('files', requires={'ctx'})
348 @templatekeyword('files', requires={'ctx'})
348 def showfiles(context, mapping):
349 def showfiles(context, mapping):
@@ -15,6 +15,10 b''
15
15
16 == Bug Fixes ==
16 == Bug Fixes ==
17
17
18 * issue4292: "hg log and {files} {file_adds} {file_mods} {file_dels}
19 in template show wrong files on merged revision". See details in
20 "Backwards Compatibility Changes".
21
18
22
19 == Backwards Compatibility Changes ==
23 == Backwards Compatibility Changes ==
20
24
@@ -31,6 +35,16 b''
31 previously replace files *in* the configured directory by
35 previously replace files *in* the configured directory by
32 subdirectories.
36 subdirectories.
33
37
38 * Template keyword `{file_mods}`, `{file_adds}`, and `{file_dels}`
39 have changed behavior on merge commits. They used to be relative to
40 the first parent, but they now consider both parents. `{file_adds}`
41 shows files that exists in the commit but did not exist in either
42 parent. `{file_dels}` shows files that do not exist in the commit
43 but existed in either parent. `{file_mods}` show the remaining
44 files from `{files}` that were not in the other two
45 sets.
46
47
34 == Internal API Changes ==
48 == Internal API Changes ==
35
49
36 * Matchers are no longer iterable. Use `match.files()` instead.
50 * Matchers are no longer iterable. Use `match.files()` instead.
@@ -59,7 +59,7 b' move should be recorded in the fixup mer'
59 $ glog -R source-hg
59 $ glog -R source-hg
60 o 5@source "(octopus merge fixup)" files+: [], files-: [], files: [renamed]
60 o 5@source "(octopus merge fixup)" files+: [], files-: [], files: [renamed]
61 |\
61 |\
62 | o 4@source "Merged branches" files+: [file-branch1 file-branch2 renamed], files-: [rename_me], files: [file]
62 | o 4@source "Merged branches" files+: [file-branch2 renamed], files-: [rename_me], files: []
63 | |\
63 | |\
64 o---+ 3@source-branch2 "Added brach2 file" files+: [file-branch2 renamed], files-: [rename_me], files: []
64 o---+ 3@source-branch2 "Added brach2 file" files+: [file-branch2 renamed], files-: [rename_me], files: []
65 / /
65 / /
@@ -154,7 +154,7 b" there. It's not recorded as a move in r"
154 $ glog -R hg2hg
154 $ glog -R hg2hg
155 @ 5@source "(octopus merge fixup)" files+: [], files-: [], files: []
155 @ 5@source "(octopus merge fixup)" files+: [], files-: [], files: []
156 |\
156 |\
157 | o 4@source "Merged branches" files+: [file-branch1 file-branch2 renamed], files-: [rename_me], files: [file]
157 | o 4@source "Merged branches" files+: [file-branch2 renamed], files-: [rename_me], files: []
158 | |\
158 | |\
159 o---+ 3@source-branch2 "Added brach2 file" files+: [file-branch2 renamed], files-: [rename_me], files: []
159 o---+ 3@source-branch2 "Added brach2 file" files+: [file-branch2 renamed], files-: [rename_me], files: []
160 / /
160 / /
@@ -147,7 +147,7 b' merge'
147 1 Editing b
147 1 Editing b
148 0 Merged improve branch
148 0 Merged improve branch
149 $ glog -R source-hg
149 $ glog -R source-hg
150 o 3@source "Merged improve branch" files+: [], files-: [], files: [b]
150 o 3@source "Merged improve branch" files+: [], files-: [], files: []
151 |\
151 |\
152 | o 2@source-improve "Editing b" files+: [], files-: [], files: [b]
152 | o 2@source-improve "Editing b" files+: [], files-: [], files: [b]
153 | |
153 | |
@@ -809,9 +809,9 b' Test files lists on merge commit:'
809 $ hg log -l1 -T '{files}\n'
809 $ hg log -l1 -T '{files}\n'
810 a fourth
810 a fourth
811 $ hg log -l1 -T '{file_mods}\n'
811 $ hg log -l1 -T '{file_mods}\n'
812 third
812
813 $ hg log -l1 -T '{file_adds}\n'
813 $ hg log -l1 -T '{file_adds}\n'
814 b fifth
814
815 $ hg log -l1 -T '{file_dels}\n'
815 $ hg log -l1 -T '{file_dels}\n'
816 a fourth
816 a fourth
817
817
General Comments 0
You need to be logged in to leave comments. Login now