annotate mercurial/templates/json/map @ 24713:2f43f8cf8219

json: implement {filediff} template Single letter properties are used to keep payload size down, as diff representation can be quite large and longer property names can create a lot of extra work for parsers. Rename is not yet captured. This can be done in a follow-up.
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 10 Apr 2015 22:39:22 -0400
parents 517f3e190a5d
children 84859415a4c9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
24544
71e96b9fd3fd templates: add a stub template for json
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
1 mimetype = 'application/json'
71e96b9fd3fd templates: add a stub template for json
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
2 filerevision = '"not yet implemented"'
71e96b9fd3fd templates: add a stub template for json
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
3 search = '"not yet implemented"'
24588
0bf54479a9eb json: implement {shortlog} and {changelog} templates
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24564
diff changeset
4 # changelog and shortlog are the same web API but with different
0bf54479a9eb json: implement {shortlog} and {changelog} templates
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24564
diff changeset
5 # number of entries.
0bf54479a9eb json: implement {shortlog} and {changelog} templates
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24564
diff changeset
6 changelog = changelist.tmpl
0bf54479a9eb json: implement {shortlog} and {changelog} templates
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24564
diff changeset
7 shortlog = changelist.tmpl
0bf54479a9eb json: implement {shortlog} and {changelog} templates
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24564
diff changeset
8 changelistentry = '\{
0bf54479a9eb json: implement {shortlog} and {changelog} templates
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24564
diff changeset
9 "node": {node|json},
0bf54479a9eb json: implement {shortlog} and {changelog} templates
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24564
diff changeset
10 "date": {date|json},
0bf54479a9eb json: implement {shortlog} and {changelog} templates
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24564
diff changeset
11 "desc": {desc|json},
0bf54479a9eb json: implement {shortlog} and {changelog} templates
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24564
diff changeset
12 "bookmarks": [{join(bookmarks%changelistentryname, ", ")}],
0bf54479a9eb json: implement {shortlog} and {changelog} templates
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24564
diff changeset
13 "tags": [{join(tags%changelistentryname, ", ")}],
0bf54479a9eb json: implement {shortlog} and {changelog} templates
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24564
diff changeset
14 "user": {author|json}
0bf54479a9eb json: implement {shortlog} and {changelog} templates
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24564
diff changeset
15 }'
0bf54479a9eb json: implement {shortlog} and {changelog} templates
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24564
diff changeset
16 changelistentryname = '{name|json}'
24563
830280536946 json: implement {changeset} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24547
diff changeset
17 changeset = '\{
830280536946 json: implement {changeset} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24547
diff changeset
18 "node": {node|json},
830280536946 json: implement {changeset} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24547
diff changeset
19 "date": {date|json},
830280536946 json: implement {changeset} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24547
diff changeset
20 "desc": {desc|json},
830280536946 json: implement {changeset} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24547
diff changeset
21 "branch": {if(branch, branch%changesetbranch, "default"|json)},
830280536946 json: implement {changeset} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24547
diff changeset
22 "bookmarks": [{join(changesetbookmark, ", ")}],
830280536946 json: implement {changeset} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24547
diff changeset
23 "tags": [{join(changesettag, ", ")}],
830280536946 json: implement {changeset} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24547
diff changeset
24 "user": {author|json},
24564
5ec4bda3097a hgweb: add phase to {changeset} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24563
diff changeset
25 "parents": [{join(parent%changesetparent, ", ")}],
5ec4bda3097a hgweb: add phase to {changeset} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24563
diff changeset
26 "phase": {phase|json}
24563
830280536946 json: implement {changeset} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24547
diff changeset
27 }'
830280536946 json: implement {changeset} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24547
diff changeset
28 changesetbranch = '{name|json}'
830280536946 json: implement {changeset} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24547
diff changeset
29 changesetbookmark = '{bookmark|json}'
830280536946 json: implement {changeset} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24547
diff changeset
30 changesettag = '{tag|json}'
830280536946 json: implement {changeset} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24547
diff changeset
31 changesetparent = '{node|json}'
24589
30a737ae9b7d json: implement {manifest} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24588
diff changeset
32 manifest = '\{
30a737ae9b7d json: implement {manifest} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24588
diff changeset
33 "node": {node|json},
30a737ae9b7d json: implement {manifest} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24588
diff changeset
34 "abspath": {path|json},
30a737ae9b7d json: implement {manifest} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24588
diff changeset
35 "directories": [{join(dentries%direntry, ", ")}],
30a737ae9b7d json: implement {manifest} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24588
diff changeset
36 "files": [{join(fentries%fileentry, ", ")}],
30a737ae9b7d json: implement {manifest} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24588
diff changeset
37 "bookmarks": [{join(bookmarks%name, ", ")}],
30a737ae9b7d json: implement {manifest} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24588
diff changeset
38 "tags": [{join(tags%name, ", ")}]
30a737ae9b7d json: implement {manifest} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24588
diff changeset
39 }'
30a737ae9b7d json: implement {manifest} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24588
diff changeset
40 name = '{name|json}'
30a737ae9b7d json: implement {manifest} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24588
diff changeset
41 direntry = '\{
30a737ae9b7d json: implement {manifest} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24588
diff changeset
42 "abspath": {path|json},
30a737ae9b7d json: implement {manifest} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24588
diff changeset
43 "basename": {basename|json},
30a737ae9b7d json: implement {manifest} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24588
diff changeset
44 "emptydirs": {emptydirs|json}
30a737ae9b7d json: implement {manifest} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24588
diff changeset
45 }'
30a737ae9b7d json: implement {manifest} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24588
diff changeset
46 fileentry = '\{
30a737ae9b7d json: implement {manifest} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24588
diff changeset
47 "abspath": {file|json},
30a737ae9b7d json: implement {manifest} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24588
diff changeset
48 "basename": {basename|json},
30a737ae9b7d json: implement {manifest} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24588
diff changeset
49 "date": {date|json},
30a737ae9b7d json: implement {manifest} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24588
diff changeset
50 "size": {size|json},
30a737ae9b7d json: implement {manifest} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24588
diff changeset
51 "flags": {permissions|json}
30a737ae9b7d json: implement {manifest} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24588
diff changeset
52 }'
24545
9e0c67e84896 json: implement {tags} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24544
diff changeset
53 tags = '\{
9e0c67e84896 json: implement {tags} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24544
diff changeset
54 "node": {node|json},
9e0c67e84896 json: implement {tags} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24544
diff changeset
55 "tags": [{join(entriesnotip%tagentry, ", ")}]
9e0c67e84896 json: implement {tags} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24544
diff changeset
56 }'
9e0c67e84896 json: implement {tags} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24544
diff changeset
57 tagentry = '\{
9e0c67e84896 json: implement {tags} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24544
diff changeset
58 "tag": {tag|json},
9e0c67e84896 json: implement {tags} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24544
diff changeset
59 "node": {node|json},
9e0c67e84896 json: implement {tags} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24544
diff changeset
60 "date": {date|json}
9e0c67e84896 json: implement {tags} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24544
diff changeset
61 }'
24546
adfd808c123f json: implement {bookmarks} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24545
diff changeset
62 bookmarks = '\{
adfd808c123f json: implement {bookmarks} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24545
diff changeset
63 "node": {node|json},
adfd808c123f json: implement {bookmarks} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24545
diff changeset
64 "bookmarks": [{join(entries%bookmarkentry, ", ")}]
adfd808c123f json: implement {bookmarks} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24545
diff changeset
65 }'
adfd808c123f json: implement {bookmarks} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24545
diff changeset
66 bookmarkentry = '\{
adfd808c123f json: implement {bookmarks} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24545
diff changeset
67 "bookmark": {bookmark|json},
adfd808c123f json: implement {bookmarks} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24545
diff changeset
68 "node": {node|json},
adfd808c123f json: implement {bookmarks} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24545
diff changeset
69 "date": {date|json}
adfd808c123f json: implement {bookmarks} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24545
diff changeset
70 }'
24547
495f3e665b27 json: implement {branches} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24546
diff changeset
71 branches = '\{
495f3e665b27 json: implement {branches} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24546
diff changeset
72 "branches": [{join(entries%branchentry, ", ")}]
495f3e665b27 json: implement {branches} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24546
diff changeset
73 }'
495f3e665b27 json: implement {branches} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24546
diff changeset
74 branchentry = '\{
495f3e665b27 json: implement {branches} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24546
diff changeset
75 "branch": {branch|json},
495f3e665b27 json: implement {branches} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24546
diff changeset
76 "node": {node|json},
495f3e665b27 json: implement {branches} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24546
diff changeset
77 "date": {date|json},
495f3e665b27 json: implement {branches} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24546
diff changeset
78 "status": {status|json}
495f3e665b27 json: implement {branches} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24546
diff changeset
79 }'
24544
71e96b9fd3fd templates: add a stub template for json
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
80 summary = '"not yet implemented"'
24713
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
81 filediff = '\{
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
82 "path": {file|json},
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
83 "node": {node|json},
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
84 "date": {date|json},
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
85 "desc": {desc|json},
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
86 "author": {author|json},
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
87 "parents": [{join(parent%changesetparent, ", ")}],
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
88 "children": [{join(child%changesetparent, ", ")}],
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
89 "diff": [{join(diff%diffblock, ", ")}]
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
90 }'
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
91 diffblock = '\{
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
92 "blockno": {blockno|json},
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
93 "lines": [{join(lines, ", ")}]
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
94 }'
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
95 difflineplus = '\{
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
96 "t": "+",
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
97 "n": {lineno|json},
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
98 "l": {line|json}
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
99 }'
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
100 difflineminus = '\{
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
101 "t": "-",
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
102 "n": {lineno|json},
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
103 "l": {line|json}
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
104 }'
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
105 difflineat = '\{
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
106 "t": "@",
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
107 "n": {lineno|json},
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
108 "l": {line|json}
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
109 }'
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
110 diffline = '\{
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
111 "t": "",
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
112 "n": {lineno|json},
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
113 "l": {line|json}
2f43f8cf8219 json: implement {filediff} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24591
diff changeset
114 }'
24544
71e96b9fd3fd templates: add a stub template for json
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
115 filecomparison = '"not yet implemented"'
71e96b9fd3fd templates: add a stub template for json
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
116 fileannotate = '"not yet implemented"'
71e96b9fd3fd templates: add a stub template for json
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
117 filelog = '"not yet implemented"'
71e96b9fd3fd templates: add a stub template for json
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
118 graph = '"not yet implemented"'
24590
0bb733dfcabe json: implement {helptopics} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24589
diff changeset
119 helptopics = '\{
0bb733dfcabe json: implement {helptopics} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24589
diff changeset
120 "topics": [{join(topics%helptopicentry, ", ")}],
0bb733dfcabe json: implement {helptopics} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24589
diff changeset
121 "earlycommands": [{join(earlycommands%helptopicentry, ", ")}],
0bb733dfcabe json: implement {helptopics} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24589
diff changeset
122 "othercommands": [{join(othercommands%helptopicentry, ", ")}]
0bb733dfcabe json: implement {helptopics} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24589
diff changeset
123 }'
0bb733dfcabe json: implement {helptopics} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24589
diff changeset
124 helptopicentry = '\{
0bb733dfcabe json: implement {helptopics} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24589
diff changeset
125 "topic": {topic|json},
0bb733dfcabe json: implement {helptopics} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24589
diff changeset
126 "summary": {summary|json}
0bb733dfcabe json: implement {helptopics} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24589
diff changeset
127 }'
24591
517f3e190a5d json: implement {help} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24590
diff changeset
128 help = '\{
517f3e190a5d json: implement {help} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24590
diff changeset
129 "topic": {topic|json},
517f3e190a5d json: implement {help} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24590
diff changeset
130 "rawdoc": {doc|json}
517f3e190a5d json: implement {help} template
Gregory Szorc <gregory.szorc@gmail.com>
parents: 24590
diff changeset
131 }'
24544
71e96b9fd3fd templates: add a stub template for json
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
132 filenodelink = ''
71e96b9fd3fd templates: add a stub template for json
Gregory Szorc <gregory.szorc@gmail.com>
parents:
diff changeset
133 filenolink = ''