##// END OF EJS Templates
json: implement {changeset} template...
Gregory Szorc -
r24563:83028053 default
parent child Browse files
Show More
@@ -1,44 +1,57 b''
1 mimetype = 'application/json'
1 mimetype = 'application/json'
2 filerevision = '"not yet implemented"'
2 filerevision = '"not yet implemented"'
3 search = '"not yet implemented"'
3 search = '"not yet implemented"'
4 shortlog = '"not yet implemented"'
4 shortlog = '"not yet implemented"'
5 changelog = '"not yet implemented"'
5 changelog = '"not yet implemented"'
6 changeset = '"not yet implemented"'
6 changeset = '\{
7 "node": {node|json},
8 "date": {date|json},
9 "desc": {desc|json},
10 "branch": {if(branch, branch%changesetbranch, "default"|json)},
11 "bookmarks": [{join(changesetbookmark, ", ")}],
12 "tags": [{join(changesettag, ", ")}],
13 "user": {author|json},
14 "parents": [{join(parent%changesetparent, ", ")}]
15 }'
16 changesetbranch = '{name|json}'
17 changesetbookmark = '{bookmark|json}'
18 changesettag = '{tag|json}'
19 changesetparent = '{node|json}'
7 manifest = '"not yet implemented"'
20 manifest = '"not yet implemented"'
8 tags = '\{
21 tags = '\{
9 "node": {node|json},
22 "node": {node|json},
10 "tags": [{join(entriesnotip%tagentry, ", ")}]
23 "tags": [{join(entriesnotip%tagentry, ", ")}]
11 }'
24 }'
12 tagentry = '\{
25 tagentry = '\{
13 "tag": {tag|json},
26 "tag": {tag|json},
14 "node": {node|json},
27 "node": {node|json},
15 "date": {date|json}
28 "date": {date|json}
16 }'
29 }'
17 bookmarks = '\{
30 bookmarks = '\{
18 "node": {node|json},
31 "node": {node|json},
19 "bookmarks": [{join(entries%bookmarkentry, ", ")}]
32 "bookmarks": [{join(entries%bookmarkentry, ", ")}]
20 }'
33 }'
21 bookmarkentry = '\{
34 bookmarkentry = '\{
22 "bookmark": {bookmark|json},
35 "bookmark": {bookmark|json},
23 "node": {node|json},
36 "node": {node|json},
24 "date": {date|json}
37 "date": {date|json}
25 }'
38 }'
26 branches = '\{
39 branches = '\{
27 "branches": [{join(entries%branchentry, ", ")}]
40 "branches": [{join(entries%branchentry, ", ")}]
28 }'
41 }'
29 branchentry = '\{
42 branchentry = '\{
30 "branch": {branch|json},
43 "branch": {branch|json},
31 "node": {node|json},
44 "node": {node|json},
32 "date": {date|json},
45 "date": {date|json},
33 "status": {status|json}
46 "status": {status|json}
34 }'
47 }'
35 summary = '"not yet implemented"'
48 summary = '"not yet implemented"'
36 filediff = '"not yet implemented"'
49 filediff = '"not yet implemented"'
37 filecomparison = '"not yet implemented"'
50 filecomparison = '"not yet implemented"'
38 fileannotate = '"not yet implemented"'
51 fileannotate = '"not yet implemented"'
39 filelog = '"not yet implemented"'
52 filelog = '"not yet implemented"'
40 graph = '"not yet implemented"'
53 graph = '"not yet implemented"'
41 helptopics = '"not yet implemented"'
54 helptopics = '"not yet implemented"'
42 help = '"not yet implemented"'
55 help = '"not yet implemented"'
43 filenodelink = ''
56 filenodelink = ''
44 filenolink = ''
57 filenolink = ''
@@ -1,302 +1,385 b''
1 #require json
1 #require json
2 #require serve
2 #require serve
3
3
4 $ request() {
4 $ request() {
5 > $TESTDIR/get-with-headers.py --json localhost:$HGPORT "$1"
5 > $TESTDIR/get-with-headers.py --json localhost:$HGPORT "$1"
6 > }
6 > }
7
7
8 $ hg init test
8 $ hg init test
9 $ cd test
9 $ cd test
10 $ mkdir da
10 $ mkdir da
11 $ echo foo > da/foo
11 $ echo foo > da/foo
12 $ echo foo > foo
12 $ echo foo > foo
13 $ hg -q ci -A -m initial
13 $ hg -q ci -A -m initial
14 $ echo bar > foo
14 $ echo bar > foo
15 $ hg ci -m 'modify foo'
15 $ hg ci -m 'modify foo'
16 $ echo bar > da/foo
16 $ echo bar > da/foo
17 $ hg ci -m 'modify da/foo'
17 $ hg ci -m 'modify da/foo'
18 $ hg bookmark bookmark1
18 $ hg bookmark bookmark1
19 $ hg up default
19 $ hg up default
20 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
20 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
21 (leaving bookmark bookmark1)
21 (leaving bookmark bookmark1)
22 $ hg mv foo foo-new
22 $ hg mv foo foo-new
23 $ hg commit -m 'move foo'
23 $ hg commit -m 'move foo'
24 $ hg tag -m 'create tag' tag1
24 $ hg tag -m 'create tag' tag1
25 $ echo baz > da/foo
25 $ echo baz > da/foo
26 $ hg commit -m 'another commit to da/foo'
26 $ hg commit -m 'another commit to da/foo'
27 $ hg tag -m 'create tag2' tag2
27 $ hg tag -m 'create tag2' tag2
28 $ hg bookmark bookmark2
28 $ hg bookmark bookmark2
29 $ hg -q up -r 0
29 $ hg -q up -r 0
30 $ hg -q branch test-branch
30 $ hg -q branch test-branch
31 $ echo branch > foo
31 $ echo branch > foo
32 $ hg commit -m 'create test branch'
32 $ hg commit -m 'create test branch'
33 $ echo branch_commit_2 > foo
34 $ hg commit -m 'another commit in test-branch'
35 $ hg -q up default
36 $ hg merge --tool :local test-branch
37 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
38 (branch merge, don't forget to commit)
39 $ hg commit -m 'merge test-branch into default'
33
40
34 $ hg log -G
41 $ hg log -G
35 @ changeset: 7:6ab967a8ab34
42 @ changeset: 9:cc725e08502a
36 | branch: test-branch
43 |\ tag: tip
37 | tag: tip
44 | | parent: 6:ceed296fe500
38 | parent: 0:06e557f3edf6
45 | | parent: 8:ed66c30e87eb
39 | user: test
46 | | user: test
40 | date: Thu Jan 01 00:00:00 1970 +0000
47 | | date: Thu Jan 01 00:00:00 1970 +0000
41 | summary: create test branch
48 | | summary: merge test-branch into default
42 |
49 | |
43 | o changeset: 6:ceed296fe500
50 | o changeset: 8:ed66c30e87eb
51 | | branch: test-branch
52 | | user: test
53 | | date: Thu Jan 01 00:00:00 1970 +0000
54 | | summary: another commit in test-branch
55 | |
56 | o changeset: 7:6ab967a8ab34
57 | | branch: test-branch
58 | | parent: 0:06e557f3edf6
59 | | user: test
60 | | date: Thu Jan 01 00:00:00 1970 +0000
61 | | summary: create test branch
62 | |
63 o | changeset: 6:ceed296fe500
44 | | bookmark: bookmark2
64 | | bookmark: bookmark2
45 | | user: test
65 | | user: test
46 | | date: Thu Jan 01 00:00:00 1970 +0000
66 | | date: Thu Jan 01 00:00:00 1970 +0000
47 | | summary: create tag2
67 | | summary: create tag2
48 | |
68 | |
49 | o changeset: 5:f2890a05fea4
69 o | changeset: 5:f2890a05fea4
50 | | tag: tag2
70 | | tag: tag2
51 | | user: test
71 | | user: test
52 | | date: Thu Jan 01 00:00:00 1970 +0000
72 | | date: Thu Jan 01 00:00:00 1970 +0000
53 | | summary: another commit to da/foo
73 | | summary: another commit to da/foo
54 | |
74 | |
55 | o changeset: 4:93a8ce14f891
75 o | changeset: 4:93a8ce14f891
56 | | user: test
76 | | user: test
57 | | date: Thu Jan 01 00:00:00 1970 +0000
77 | | date: Thu Jan 01 00:00:00 1970 +0000
58 | | summary: create tag
78 | | summary: create tag
59 | |
79 | |
60 | o changeset: 3:78896eb0e102
80 o | changeset: 3:78896eb0e102
61 | | tag: tag1
81 | | tag: tag1
62 | | user: test
82 | | user: test
63 | | date: Thu Jan 01 00:00:00 1970 +0000
83 | | date: Thu Jan 01 00:00:00 1970 +0000
64 | | summary: move foo
84 | | summary: move foo
65 | |
85 | |
66 | o changeset: 2:8d7c456572ac
86 o | changeset: 2:8d7c456572ac
67 | | bookmark: bookmark1
87 | | bookmark: bookmark1
68 | | user: test
88 | | user: test
69 | | date: Thu Jan 01 00:00:00 1970 +0000
89 | | date: Thu Jan 01 00:00:00 1970 +0000
70 | | summary: modify da/foo
90 | | summary: modify da/foo
71 | |
91 | |
72 | o changeset: 1:f8bbb9024b10
92 o | changeset: 1:f8bbb9024b10
73 |/ user: test
93 |/ user: test
74 | date: Thu Jan 01 00:00:00 1970 +0000
94 | date: Thu Jan 01 00:00:00 1970 +0000
75 | summary: modify foo
95 | summary: modify foo
76 |
96 |
77 o changeset: 0:06e557f3edf6
97 o changeset: 0:06e557f3edf6
78 user: test
98 user: test
79 date: Thu Jan 01 00:00:00 1970 +0000
99 date: Thu Jan 01 00:00:00 1970 +0000
80 summary: initial
100 summary: initial
81
101
82
102
83 $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E error.log
103 $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E error.log
84 $ cat hg.pid >> $DAEMON_PIDS
104 $ cat hg.pid >> $DAEMON_PIDS
85
105
86 (Try to keep these in roughly the order they are defined in webcommands.py)
106 (Try to keep these in roughly the order they are defined in webcommands.py)
87
107
88 (log is handled by filelog/ and changelog/ - ignore it)
108 (log is handled by filelog/ and changelog/ - ignore it)
89
109
90 (rawfile/ doesn't use templating - nothing to test)
110 (rawfile/ doesn't use templating - nothing to test)
91
111
92 file/{revision}/{path} shows file revision
112 file/{revision}/{path} shows file revision
93
113
94 $ request json-file/06e557f3edf6/foo
114 $ request json-file/06e557f3edf6/foo
95 200 Script output follows
115 200 Script output follows
96
116
97 "not yet implemented"
117 "not yet implemented"
98
118
99 file/{revision} shows root directory info
119 file/{revision} shows root directory info
100
120
101 $ request json-file/06e557f3edf6
121 $ request json-file/06e557f3edf6
102 200 Script output follows
122 200 Script output follows
103
123
104 "not yet implemented"
124 "not yet implemented"
105
125
106 changelog/ shows information about several changesets
126 changelog/ shows information about several changesets
107
127
108 $ request json-changelog
128 $ request json-changelog
109 200 Script output follows
129 200 Script output follows
110
130
111 "not yet implemented"
131 "not yet implemented"
112
132
113 changelog/{revision} shows information about a single changeset
133 changelog/{revision} shows information about a single changeset
114
134
115 $ request json-changelog/06e557f3edf6
135 $ request json-changelog/06e557f3edf6
116 200 Script output follows
136 200 Script output follows
117
137
118 "not yet implemented"
138 "not yet implemented"
119
139
120 shortlog/ shows information about a set of changesets
140 shortlog/ shows information about a set of changesets
121
141
122 $ request json-shortlog
142 $ request json-shortlog
123 200 Script output follows
143 200 Script output follows
124
144
125 "not yet implemented"
145 "not yet implemented"
126
146
127 changeset/ renders the tip changeset
147 changeset/ renders the tip changeset
128
148
129 $ request json-rev
149 $ request json-rev
130 200 Script output follows
150 200 Script output follows
131
151
132 "not yet implemented"
152 {
153 "bookmarks": [],
154 "branch": "default",
155 "date": [
156 0.0,
157 0
158 ],
159 "desc": "merge test-branch into default",
160 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7",
161 "parents": [
162 "ceed296fe500c3fac9541e31dad860cb49c89e45",
163 "ed66c30e87eb65337c05a4229efaa5f1d5285a90"
164 ],
165 "tags": [
166 "tip"
167 ],
168 "user": "test"
169 }
133
170
134 changeset/{revision} shows tags
171 changeset/{revision} shows tags
135
172
136 $ request json-rev/78896eb0e102
173 $ request json-rev/78896eb0e102
137 200 Script output follows
174 200 Script output follows
138
175
139 "not yet implemented"
176 {
177 "bookmarks": [],
178 "branch": "default",
179 "date": [
180 0.0,
181 0
182 ],
183 "desc": "move foo",
184 "node": "78896eb0e102174ce9278438a95e12543e4367a7",
185 "parents": [
186 "8d7c456572acf3557e8ed8a07286b10c408bcec5"
187 ],
188 "tags": [
189 "tag1"
190 ],
191 "user": "test"
192 }
140
193
141 changeset/{revision} shows bookmarks
194 changeset/{revision} shows bookmarks
142
195
143 $ request json-rev/8d7c456572ac
196 $ request json-rev/8d7c456572ac
144 200 Script output follows
197 200 Script output follows
145
198
146 "not yet implemented"
199 {
200 "bookmarks": [
201 "bookmark1"
202 ],
203 "branch": "default",
204 "date": [
205 0.0,
206 0
207 ],
208 "desc": "modify da/foo",
209 "node": "8d7c456572acf3557e8ed8a07286b10c408bcec5",
210 "parents": [
211 "f8bbb9024b10f93cdbb8d940337398291d40dea8"
212 ],
213 "tags": [],
214 "user": "test"
215 }
147
216
148 changeset/{revision} shows branches
217 changeset/{revision} shows branches
149
218
150 $ request json-rev/6ab967a8ab34
219 $ request json-rev/6ab967a8ab34
151 200 Script output follows
220 200 Script output follows
152
221
153 "not yet implemented"
222 {
223 "bookmarks": [],
224 "branch": "test-branch",
225 "date": [
226 0.0,
227 0
228 ],
229 "desc": "create test branch",
230 "node": "6ab967a8ab3489227a83f80e920faa039a71819f",
231 "parents": [
232 "06e557f3edf66faa1ccaba5dd8c203c21cc79f1e"
233 ],
234 "tags": [],
235 "user": "test"
236 }
154
237
155 manifest/{revision}/{path} shows info about a directory at a revision
238 manifest/{revision}/{path} shows info about a directory at a revision
156
239
157 $ request json-manifest/06e557f3edf6/
240 $ request json-manifest/06e557f3edf6/
158 200 Script output follows
241 200 Script output follows
159
242
160 "not yet implemented"
243 "not yet implemented"
161
244
162 tags/ shows tags info
245 tags/ shows tags info
163
246
164 $ request json-tags
247 $ request json-tags
165 200 Script output follows
248 200 Script output follows
166
249
167 {
250 {
168 "node": "6ab967a8ab3489227a83f80e920faa039a71819f",
251 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7",
169 "tags": [
252 "tags": [
170 {
253 {
171 "date": [
254 "date": [
172 0.0,
255 0.0,
173 0
256 0
174 ],
257 ],
175 "node": "f2890a05fea49bfaf9fb27ed5490894eba32da78",
258 "node": "f2890a05fea49bfaf9fb27ed5490894eba32da78",
176 "tag": "tag2"
259 "tag": "tag2"
177 },
260 },
178 {
261 {
179 "date": [
262 "date": [
180 0.0,
263 0.0,
181 0
264 0
182 ],
265 ],
183 "node": "78896eb0e102174ce9278438a95e12543e4367a7",
266 "node": "78896eb0e102174ce9278438a95e12543e4367a7",
184 "tag": "tag1"
267 "tag": "tag1"
185 }
268 }
186 ]
269 ]
187 }
270 }
188
271
189 bookmarks/ shows bookmarks info
272 bookmarks/ shows bookmarks info
190
273
191 $ request json-bookmarks
274 $ request json-bookmarks
192 200 Script output follows
275 200 Script output follows
193
276
194 {
277 {
195 "bookmarks": [
278 "bookmarks": [
196 {
279 {
197 "bookmark": "bookmark1",
280 "bookmark": "bookmark1",
198 "date": [
281 "date": [
199 0.0,
282 0.0,
200 0
283 0
201 ],
284 ],
202 "node": "8d7c456572acf3557e8ed8a07286b10c408bcec5"
285 "node": "8d7c456572acf3557e8ed8a07286b10c408bcec5"
203 },
286 },
204 {
287 {
205 "bookmark": "bookmark2",
288 "bookmark": "bookmark2",
206 "date": [
289 "date": [
207 0.0,
290 0.0,
208 0
291 0
209 ],
292 ],
210 "node": "ceed296fe500c3fac9541e31dad860cb49c89e45"
293 "node": "ceed296fe500c3fac9541e31dad860cb49c89e45"
211 }
294 }
212 ],
295 ],
213 "node": "6ab967a8ab3489227a83f80e920faa039a71819f"
296 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7"
214 }
297 }
215
298
216 branches/ shows branches info
299 branches/ shows branches info
217
300
218 $ request json-branches
301 $ request json-branches
219 200 Script output follows
302 200 Script output follows
220
303
221 {
304 {
222 "branches": [
305 "branches": [
223 {
306 {
307 "branch": "default",
308 "date": [
309 0.0,
310 0
311 ],
312 "node": "cc725e08502a79dd1eda913760fbe06ed7a9abc7",
313 "status": "open"
314 },
315 {
224 "branch": "test-branch",
316 "branch": "test-branch",
225 "date": [
317 "date": [
226 0.0,
318 0.0,
227 0
319 0
228 ],
320 ],
229 "node": "6ab967a8ab3489227a83f80e920faa039a71819f",
321 "node": "ed66c30e87eb65337c05a4229efaa5f1d5285a90",
230 "status": "open"
322 "status": "inactive"
231 },
232 {
233 "branch": "default",
234 "date": [
235 0.0,
236 0
237 ],
238 "node": "ceed296fe500c3fac9541e31dad860cb49c89e45",
239 "status": "open"
240 }
323 }
241 ]
324 ]
242 }
325 }
243
326
244 summary/ shows a summary of repository state
327 summary/ shows a summary of repository state
245
328
246 $ request json-summary
329 $ request json-summary
247 200 Script output follows
330 200 Script output follows
248
331
249 "not yet implemented"
332 "not yet implemented"
250
333
251 filediff/{revision}/{path} shows changes to a file in a revision
334 filediff/{revision}/{path} shows changes to a file in a revision
252
335
253 $ request json-diff/f8bbb9024b10/foo
336 $ request json-diff/f8bbb9024b10/foo
254 200 Script output follows
337 200 Script output follows
255
338
256 "not yet implemented"
339 "not yet implemented"
257
340
258 comparison/{revision}/{path} shows information about before and after for a file
341 comparison/{revision}/{path} shows information about before and after for a file
259
342
260 $ request json-comparison/f8bbb9024b10/foo
343 $ request json-comparison/f8bbb9024b10/foo
261 200 Script output follows
344 200 Script output follows
262
345
263 "not yet implemented"
346 "not yet implemented"
264
347
265 annotate/{revision}/{path} shows annotations for each line
348 annotate/{revision}/{path} shows annotations for each line
266
349
267 $ request json-annotate/f8bbb9024b10/foo
350 $ request json-annotate/f8bbb9024b10/foo
268 200 Script output follows
351 200 Script output follows
269
352
270 "not yet implemented"
353 "not yet implemented"
271
354
272 filelog/{revision}/{path} shows history of a single file
355 filelog/{revision}/{path} shows history of a single file
273
356
274 $ request json-filelog/f8bbb9024b10/foo
357 $ request json-filelog/f8bbb9024b10/foo
275 200 Script output follows
358 200 Script output follows
276
359
277 "not yet implemented"
360 "not yet implemented"
278
361
279 (archive/ doesn't use templating, so ignore it)
362 (archive/ doesn't use templating, so ignore it)
280
363
281 (static/ doesn't use templating, so ignore it)
364 (static/ doesn't use templating, so ignore it)
282
365
283 graph/ shows information that can be used to render a graph of the DAG
366 graph/ shows information that can be used to render a graph of the DAG
284
367
285 $ request json-graph
368 $ request json-graph
286 200 Script output follows
369 200 Script output follows
287
370
288 "not yet implemented"
371 "not yet implemented"
289
372
290 help/ shows help topics
373 help/ shows help topics
291
374
292 $ request json-help
375 $ request json-help
293 200 Script output follows
376 200 Script output follows
294
377
295 "not yet implemented"
378 "not yet implemented"
296
379
297 help/{topic} shows an individual help topic
380 help/{topic} shows an individual help topic
298
381
299 $ request json-help/phases
382 $ request json-help/phases
300 200 Script output follows
383 200 Script output follows
301
384
302 "not yet implemented"
385 "not yet implemented"
General Comments 0
You need to be logged in to leave comments. Login now