##// END OF EJS Templates
json: implement {branches} template
Gregory Szorc -
r24547:495f3e66 default
parent child Browse files
Show More
@@ -1,36 +1,44 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 = '"not yet implemented"'
7 manifest = '"not yet implemented"'
7 manifest = '"not yet implemented"'
8 tags = '\{
8 tags = '\{
9 "node": {node|json},
9 "node": {node|json},
10 "tags": [{join(entriesnotip%tagentry, ", ")}]
10 "tags": [{join(entriesnotip%tagentry, ", ")}]
11 }'
11 }'
12 tagentry = '\{
12 tagentry = '\{
13 "tag": {tag|json},
13 "tag": {tag|json},
14 "node": {node|json},
14 "node": {node|json},
15 "date": {date|json}
15 "date": {date|json}
16 }'
16 }'
17 bookmarks = '\{
17 bookmarks = '\{
18 "node": {node|json},
18 "node": {node|json},
19 "bookmarks": [{join(entries%bookmarkentry, ", ")}]
19 "bookmarks": [{join(entries%bookmarkentry, ", ")}]
20 }'
20 }'
21 bookmarkentry = '\{
21 bookmarkentry = '\{
22 "bookmark": {bookmark|json},
22 "bookmark": {bookmark|json},
23 "node": {node|json},
23 "node": {node|json},
24 "date": {date|json}
24 "date": {date|json}
25 }'
25 }'
26 branches = '"not yet implemented"'
26 branches = '\{
27 "branches": [{join(entries%branchentry, ", ")}]
28 }'
29 branchentry = '\{
30 "branch": {branch|json},
31 "node": {node|json},
32 "date": {date|json},
33 "status": {status|json}
34 }'
27 summary = '"not yet implemented"'
35 summary = '"not yet implemented"'
28 filediff = '"not yet implemented"'
36 filediff = '"not yet implemented"'
29 filecomparison = '"not yet implemented"'
37 filecomparison = '"not yet implemented"'
30 fileannotate = '"not yet implemented"'
38 fileannotate = '"not yet implemented"'
31 filelog = '"not yet implemented"'
39 filelog = '"not yet implemented"'
32 graph = '"not yet implemented"'
40 graph = '"not yet implemented"'
33 helptopics = '"not yet implemented"'
41 helptopics = '"not yet implemented"'
34 help = '"not yet implemented"'
42 help = '"not yet implemented"'
35 filenodelink = ''
43 filenodelink = ''
36 filenolink = ''
44 filenolink = ''
@@ -1,281 +1,302 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
33
34 $ hg log -G
34 $ hg log -G
35 @ changeset: 7:6ab967a8ab34
35 @ changeset: 7:6ab967a8ab34
36 | branch: test-branch
36 | branch: test-branch
37 | tag: tip
37 | tag: tip
38 | parent: 0:06e557f3edf6
38 | parent: 0:06e557f3edf6
39 | user: test
39 | user: test
40 | date: Thu Jan 01 00:00:00 1970 +0000
40 | date: Thu Jan 01 00:00:00 1970 +0000
41 | summary: create test branch
41 | summary: create test branch
42 |
42 |
43 | o changeset: 6:ceed296fe500
43 | o changeset: 6:ceed296fe500
44 | | bookmark: bookmark2
44 | | bookmark: bookmark2
45 | | user: test
45 | | user: test
46 | | date: Thu Jan 01 00:00:00 1970 +0000
46 | | date: Thu Jan 01 00:00:00 1970 +0000
47 | | summary: create tag2
47 | | summary: create tag2
48 | |
48 | |
49 | o changeset: 5:f2890a05fea4
49 | o changeset: 5:f2890a05fea4
50 | | tag: tag2
50 | | tag: tag2
51 | | user: test
51 | | user: test
52 | | date: Thu Jan 01 00:00:00 1970 +0000
52 | | date: Thu Jan 01 00:00:00 1970 +0000
53 | | summary: another commit to da/foo
53 | | summary: another commit to da/foo
54 | |
54 | |
55 | o changeset: 4:93a8ce14f891
55 | o changeset: 4:93a8ce14f891
56 | | user: test
56 | | user: test
57 | | date: Thu Jan 01 00:00:00 1970 +0000
57 | | date: Thu Jan 01 00:00:00 1970 +0000
58 | | summary: create tag
58 | | summary: create tag
59 | |
59 | |
60 | o changeset: 3:78896eb0e102
60 | o changeset: 3:78896eb0e102
61 | | tag: tag1
61 | | tag: tag1
62 | | user: test
62 | | user: test
63 | | date: Thu Jan 01 00:00:00 1970 +0000
63 | | date: Thu Jan 01 00:00:00 1970 +0000
64 | | summary: move foo
64 | | summary: move foo
65 | |
65 | |
66 | o changeset: 2:8d7c456572ac
66 | o changeset: 2:8d7c456572ac
67 | | bookmark: bookmark1
67 | | bookmark: bookmark1
68 | | user: test
68 | | user: test
69 | | date: Thu Jan 01 00:00:00 1970 +0000
69 | | date: Thu Jan 01 00:00:00 1970 +0000
70 | | summary: modify da/foo
70 | | summary: modify da/foo
71 | |
71 | |
72 | o changeset: 1:f8bbb9024b10
72 | o changeset: 1:f8bbb9024b10
73 |/ user: test
73 |/ user: test
74 | date: Thu Jan 01 00:00:00 1970 +0000
74 | date: Thu Jan 01 00:00:00 1970 +0000
75 | summary: modify foo
75 | summary: modify foo
76 |
76 |
77 o changeset: 0:06e557f3edf6
77 o changeset: 0:06e557f3edf6
78 user: test
78 user: test
79 date: Thu Jan 01 00:00:00 1970 +0000
79 date: Thu Jan 01 00:00:00 1970 +0000
80 summary: initial
80 summary: initial
81
81
82
82
83 $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E error.log
83 $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E error.log
84 $ cat hg.pid >> $DAEMON_PIDS
84 $ cat hg.pid >> $DAEMON_PIDS
85
85
86 (Try to keep these in roughly the order they are defined in webcommands.py)
86 (Try to keep these in roughly the order they are defined in webcommands.py)
87
87
88 (log is handled by filelog/ and changelog/ - ignore it)
88 (log is handled by filelog/ and changelog/ - ignore it)
89
89
90 (rawfile/ doesn't use templating - nothing to test)
90 (rawfile/ doesn't use templating - nothing to test)
91
91
92 file/{revision}/{path} shows file revision
92 file/{revision}/{path} shows file revision
93
93
94 $ request json-rev/06e557f3edf6/foo
94 $ request json-rev/06e557f3edf6/foo
95 200 Script output follows
95 200 Script output follows
96
96
97 "not yet implemented"
97 "not yet implemented"
98
98
99 file/{revision} shows root directory info
99 file/{revision} shows root directory info
100
100
101 $ request json-rev/06e557f3edf6
101 $ request json-rev/06e557f3edf6
102 200 Script output follows
102 200 Script output follows
103
103
104 "not yet implemented"
104 "not yet implemented"
105
105
106 changelog/ shows information about several changesets
106 changelog/ shows information about several changesets
107
107
108 $ request json-changelog
108 $ request json-changelog
109 200 Script output follows
109 200 Script output follows
110
110
111 "not yet implemented"
111 "not yet implemented"
112
112
113 changelog/{revision} shows information about a single changeset
113 changelog/{revision} shows information about a single changeset
114
114
115 $ request json-changelog/06e557f3edf6
115 $ request json-changelog/06e557f3edf6
116 200 Script output follows
116 200 Script output follows
117
117
118 "not yet implemented"
118 "not yet implemented"
119
119
120 shortlog/ shows information about a set of changesets
120 shortlog/ shows information about a set of changesets
121
121
122 $ request json-shortlog
122 $ request json-shortlog
123 200 Script output follows
123 200 Script output follows
124
124
125 "not yet implemented"
125 "not yet implemented"
126
126
127 changeset/ renders the tip changeset
127 changeset/ renders the tip changeset
128
128
129 $ request json-rev
129 $ request json-rev
130 200 Script output follows
130 200 Script output follows
131
131
132 "not yet implemented"
132 "not yet implemented"
133
133
134 changeset/{revision} shows tags
134 changeset/{revision} shows tags
135
135
136 $ request json-rev/78896eb0e102
136 $ request json-rev/78896eb0e102
137 200 Script output follows
137 200 Script output follows
138
138
139 "not yet implemented"
139 "not yet implemented"
140
140
141 changeset/{revision} shows bookmarks
141 changeset/{revision} shows bookmarks
142
142
143 $ request json-rev/8d7c456572ac
143 $ request json-rev/8d7c456572ac
144 200 Script output follows
144 200 Script output follows
145
145
146 "not yet implemented"
146 "not yet implemented"
147
147
148 changeset/{revision} shows branches
148 changeset/{revision} shows branches
149
149
150 $ request json-rev/6ab967a8ab34
150 $ request json-rev/6ab967a8ab34
151 200 Script output follows
151 200 Script output follows
152
152
153 "not yet implemented"
153 "not yet implemented"
154
154
155 manifest/{revision}/{path} shows info about a directory at a revision
155 manifest/{revision}/{path} shows info about a directory at a revision
156
156
157 $ request json-manifest/06e557f3edf6/
157 $ request json-manifest/06e557f3edf6/
158 200 Script output follows
158 200 Script output follows
159
159
160 "not yet implemented"
160 "not yet implemented"
161
161
162 tags/ shows tags info
162 tags/ shows tags info
163
163
164 $ request json-tags
164 $ request json-tags
165 200 Script output follows
165 200 Script output follows
166
166
167 {
167 {
168 "node": "6ab967a8ab3489227a83f80e920faa039a71819f",
168 "node": "6ab967a8ab3489227a83f80e920faa039a71819f",
169 "tags": [
169 "tags": [
170 {
170 {
171 "date": [
171 "date": [
172 0.0,
172 0.0,
173 0
173 0
174 ],
174 ],
175 "node": "f2890a05fea49bfaf9fb27ed5490894eba32da78",
175 "node": "f2890a05fea49bfaf9fb27ed5490894eba32da78",
176 "tag": "tag2"
176 "tag": "tag2"
177 },
177 },
178 {
178 {
179 "date": [
179 "date": [
180 0.0,
180 0.0,
181 0
181 0
182 ],
182 ],
183 "node": "78896eb0e102174ce9278438a95e12543e4367a7",
183 "node": "78896eb0e102174ce9278438a95e12543e4367a7",
184 "tag": "tag1"
184 "tag": "tag1"
185 }
185 }
186 ]
186 ]
187 }
187 }
188
188
189 bookmarks/ shows bookmarks info
189 bookmarks/ shows bookmarks info
190
190
191 $ request json-bookmarks
191 $ request json-bookmarks
192 200 Script output follows
192 200 Script output follows
193
193
194 {
194 {
195 "bookmarks": [
195 "bookmarks": [
196 {
196 {
197 "bookmark": "bookmark1",
197 "bookmark": "bookmark1",
198 "date": [
198 "date": [
199 0.0,
199 0.0,
200 0
200 0
201 ],
201 ],
202 "node": "8d7c456572acf3557e8ed8a07286b10c408bcec5"
202 "node": "8d7c456572acf3557e8ed8a07286b10c408bcec5"
203 },
203 },
204 {
204 {
205 "bookmark": "bookmark2",
205 "bookmark": "bookmark2",
206 "date": [
206 "date": [
207 0.0,
207 0.0,
208 0
208 0
209 ],
209 ],
210 "node": "ceed296fe500c3fac9541e31dad860cb49c89e45"
210 "node": "ceed296fe500c3fac9541e31dad860cb49c89e45"
211 }
211 }
212 ],
212 ],
213 "node": "6ab967a8ab3489227a83f80e920faa039a71819f"
213 "node": "6ab967a8ab3489227a83f80e920faa039a71819f"
214 }
214 }
215
215
216 branches/ shows branches info
216 branches/ shows branches info
217
217
218 $ request json-branches
218 $ request json-branches
219 200 Script output follows
219 200 Script output follows
220
220
221 "not yet implemented"
221 {
222 "branches": [
223 {
224 "branch": "test-branch",
225 "date": [
226 0.0,
227 0
228 ],
229 "node": "6ab967a8ab3489227a83f80e920faa039a71819f",
230 "status": "open"
231 },
232 {
233 "branch": "default",
234 "date": [
235 0.0,
236 0
237 ],
238 "node": "ceed296fe500c3fac9541e31dad860cb49c89e45",
239 "status": "open"
240 }
241 ]
242 }
222
243
223 summary/ shows a summary of repository state
244 summary/ shows a summary of repository state
224
245
225 $ request json-summary
246 $ request json-summary
226 200 Script output follows
247 200 Script output follows
227
248
228 "not yet implemented"
249 "not yet implemented"
229
250
230 filediff/{revision}/{path} shows changes to a file in a revision
251 filediff/{revision}/{path} shows changes to a file in a revision
231
252
232 $ request json-diff/f8bbb9024b10/foo
253 $ request json-diff/f8bbb9024b10/foo
233 200 Script output follows
254 200 Script output follows
234
255
235 "not yet implemented"
256 "not yet implemented"
236
257
237 comparison/{revision}/{path} shows information about before and after for a file
258 comparison/{revision}/{path} shows information about before and after for a file
238
259
239 $ request json-comparison/f8bbb9024b10/foo
260 $ request json-comparison/f8bbb9024b10/foo
240 200 Script output follows
261 200 Script output follows
241
262
242 "not yet implemented"
263 "not yet implemented"
243
264
244 annotate/{revision}/{path} shows annotations for each line
265 annotate/{revision}/{path} shows annotations for each line
245
266
246 $ request json-annotate/f8bbb9024b10/foo
267 $ request json-annotate/f8bbb9024b10/foo
247 200 Script output follows
268 200 Script output follows
248
269
249 "not yet implemented"
270 "not yet implemented"
250
271
251 filelog/{revision}/{path} shows history of a single file
272 filelog/{revision}/{path} shows history of a single file
252
273
253 $ request json-filelog/f8bbb9024b10/foo
274 $ request json-filelog/f8bbb9024b10/foo
254 200 Script output follows
275 200 Script output follows
255
276
256 "not yet implemented"
277 "not yet implemented"
257
278
258 (archive/ doesn't use templating, so ignore it)
279 (archive/ doesn't use templating, so ignore it)
259
280
260 (static/ doesn't use templating, so ignore it)
281 (static/ doesn't use templating, so ignore it)
261
282
262 graph/ shows information that can be used to render a graph of the DAG
283 graph/ shows information that can be used to render a graph of the DAG
263
284
264 $ request json-graph
285 $ request json-graph
265 200 Script output follows
286 200 Script output follows
266
287
267 "not yet implemented"
288 "not yet implemented"
268
289
269 help/ shows help topics
290 help/ shows help topics
270
291
271 $ request json-help
292 $ request json-help
272 200 Script output follows
293 200 Script output follows
273
294
274 "not yet implemented"
295 "not yet implemented"
275
296
276 help/{topic} shows an individual help topic
297 help/{topic} shows an individual help topic
277
298
278 $ request json-help/phases
299 $ request json-help/phases
279 200 Script output follows
300 200 Script output follows
280
301
281 "not yet implemented"
302 "not yet implemented"
General Comments 0
You need to be logged in to leave comments. Login now