Mercurial > hg
annotate mercurial/templates/map-cmdline.xml @ 31276:cd29673cebdb
hgweb: use patch.diffhunks in webutil.diffs to simplify the algorithm
Function patch.diffhunks yields items for a "block" (i.e. a file) as a whole
so take advantage of this to simplify the algorithm and avoid parsing diff
lines to determine whether we're starting a new "block" or not. Thus we drop
to external block counter and rely on diffhunks iterations instead.
We also take advantage of the fact that patch.diffhunks() yields *lines* of
hunks (instead of a string) to avoid building a list that is ''.join-ed into a
string that is then split.
As lines in 'header' returned by patch.diffhunks() have no trailing new line,
we need to insert it ourselves to match template expectations.
author | Denis Laxalde <denis.laxalde@logilab.fr> |
---|---|
date | Mon, 06 Mar 2017 09:28:33 +0100 |
parents | 3095b1027661 |
children | f4aeb952ab77 |
rev | line source |
---|---|
26222
3095b1027661
templater: add new docheader/footer components for XML (issue4135)
Matt Mackall <mpm@selenic.com>
parents:
13387
diff
changeset
|
1 docheader = '<?xml version="1.0"?>\n<log>\n' |
3095b1027661
templater: add new docheader/footer components for XML (issue4135)
Matt Mackall <mpm@selenic.com>
parents:
13387
diff
changeset
|
2 docfooter = '</log>\n' |
10153 | 3 |
13387
0be2fe6a0843
templates: add bookmarks to command line styles
David Soria Parra <dsp@php.net>
parents:
10159
diff
changeset
|
4 changeset = '<logentry revision="{rev}" node="{node}">\n{branches}{bookmarks}{tags}{parents}<author email="{author|email|xmlescape}">{author|person|xmlescape}</author>\n<date>{date|rfc3339date}</date>\n<msg xml:space="preserve">{desc|xmlescape}</msg>\n</logentry>\n' |
0be2fe6a0843
templates: add bookmarks to command line styles
David Soria Parra <dsp@php.net>
parents:
10159
diff
changeset
|
5 changeset_verbose = '<logentry revision="{rev}" node="{node}">\n{branches}{bookmarks}{tags}{parents}<author email="{author|email|xmlescape}">{author|person|xmlescape}</author>\n<date>{date|rfc3339date}</date>\n<msg xml:space="preserve">{desc|xmlescape}</msg>\n<paths>\n{file_adds}{file_dels}{file_mods}</paths>\n{file_copies}</logentry>\n' |
0be2fe6a0843
templates: add bookmarks to command line styles
David Soria Parra <dsp@php.net>
parents:
10159
diff
changeset
|
6 changeset_debug = '<logentry revision="{rev}" node="{node}">\n{branches}{bookmarks}{tags}{parents}<author email="{author|email|xmlescape}">{author|person|xmlescape}</author>\n<date>{date|rfc3339date}</date>\n<msg xml:space="preserve">{desc|xmlescape}</msg>\n<paths>\n{file_adds}{file_dels}{file_mods}</paths>\n{file_copies}{extras}</logentry>\n' |
10153 | 7 |
8 file_add = '<path action="A">{file_add|xmlescape}</path>\n' | |
9 file_mod = '<path action="M">{file_mod|xmlescape}</path>\n' | |
10 file_del = '<path action="R">{file_del|xmlescape}</path>\n' | |
11 | |
12 start_file_copies = '<copies>\n' | |
13 file_copy = '<copy source="{source|xmlescape}">{name|xmlescape}</copy>\n' | |
14 end_file_copies = '</copies>\n' | |
15 | |
16 parent = '<parent revision="{rev}" node="{node}" />\n' | |
17 branch = '<branch>{branch|xmlescape}</branch>\n' | |
18 tag = '<tag>{tag|xmlescape}</tag>\n' | |
13387
0be2fe6a0843
templates: add bookmarks to command line styles
David Soria Parra <dsp@php.net>
parents:
10159
diff
changeset
|
19 bookmark = '<bookmark>{bookmark|xmlescape}</bookmark>\n' |
10159
182416227722
Added output of "extras" to hg log XML output
Robert Bachmann <rbachm@gmail.com>
parents:
10153
diff
changeset
|
20 extra = '<extra key="{key|xmlescape}">{value|xmlescape}</extra>\n' |