comparison tests/test-hgweb-json.t @ 24544:71e96b9fd3fd

templates: add a stub template for json Many have long wanted hgweb to emit a common machine readable output. We start the process by defining a stub json template. Right now, each endpoint returns a stub "not yet implemented" string. Individual templates will be implemented in subsequent patches. Basic tests for templates have been included. Coverage isn't perfect, but it is better than nothing.
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 30 Mar 2015 20:15:03 -0700
parents
children 9e0c67e84896
comparison
equal deleted inserted replaced
24543:747401086a38 24544:71e96b9fd3fd
1 #require json
2 #require serve
3
4 $ request() {
5 > $TESTDIR/get-with-headers.py --json localhost:$HGPORT "$1"
6 > }
7
8 $ hg init test
9 $ cd test
10 $ mkdir da
11 $ echo foo > da/foo
12 $ echo foo > foo
13 $ hg -q ci -A -m initial
14 $ echo bar > foo
15 $ hg ci -m 'modify foo'
16 $ echo bar > da/foo
17 $ hg ci -m 'modify da/foo'
18 $ hg bookmark bookmark1
19 $ hg up default
20 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
21 (leaving bookmark bookmark1)
22 $ hg mv foo foo-new
23 $ hg commit -m 'move foo'
24 $ hg tag -m 'create tag' tag1
25 $ echo baz > da/foo
26 $ hg commit -m 'another commit to da/foo'
27 $ hg tag -m 'create tag2' tag2
28 $ hg bookmark bookmark2
29 $ hg -q up -r 0
30 $ hg -q branch test-branch
31 $ echo branch > foo
32 $ hg commit -m 'create test branch'
33
34 $ hg log -G
35 @ changeset: 7:6ab967a8ab34
36 | branch: test-branch
37 | tag: tip
38 | parent: 0:06e557f3edf6
39 | user: test
40 | date: Thu Jan 01 00:00:00 1970 +0000
41 | summary: create test branch
42 |
43 | o changeset: 6:ceed296fe500
44 | | bookmark: bookmark2
45 | | user: test
46 | | date: Thu Jan 01 00:00:00 1970 +0000
47 | | summary: create tag2
48 | |
49 | o changeset: 5:f2890a05fea4
50 | | tag: tag2
51 | | user: test
52 | | date: Thu Jan 01 00:00:00 1970 +0000
53 | | summary: another commit to da/foo
54 | |
55 | o changeset: 4:93a8ce14f891
56 | | user: test
57 | | date: Thu Jan 01 00:00:00 1970 +0000
58 | | summary: create tag
59 | |
60 | o changeset: 3:78896eb0e102
61 | | tag: tag1
62 | | user: test
63 | | date: Thu Jan 01 00:00:00 1970 +0000
64 | | summary: move foo
65 | |
66 | o changeset: 2:8d7c456572ac
67 | | bookmark: bookmark1
68 | | user: test
69 | | date: Thu Jan 01 00:00:00 1970 +0000
70 | | summary: modify da/foo
71 | |
72 | o changeset: 1:f8bbb9024b10
73 |/ user: test
74 | date: Thu Jan 01 00:00:00 1970 +0000
75 | summary: modify foo
76 |
77 o changeset: 0:06e557f3edf6
78 user: test
79 date: Thu Jan 01 00:00:00 1970 +0000
80 summary: initial
81
82
83 $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E error.log
84 $ cat hg.pid >> $DAEMON_PIDS
85
86 (Try to keep these in roughly the order they are defined in webcommands.py)
87
88 (log is handled by filelog/ and changelog/ - ignore it)
89
90 (rawfile/ doesn't use templating - nothing to test)
91
92 file/{revision}/{path} shows file revision
93
94 $ request json-rev/06e557f3edf6/foo
95 200 Script output follows
96
97 "not yet implemented"
98
99 file/{revision} shows root directory info
100
101 $ request json-rev/06e557f3edf6
102 200 Script output follows
103
104 "not yet implemented"
105
106 changelog/ shows information about several changesets
107
108 $ request json-changelog
109 200 Script output follows
110
111 "not yet implemented"
112
113 changelog/{revision} shows information about a single changeset
114
115 $ request json-changelog/06e557f3edf6
116 200 Script output follows
117
118 "not yet implemented"
119
120 shortlog/ shows information about a set of changesets
121
122 $ request json-shortlog
123 200 Script output follows
124
125 "not yet implemented"
126
127 changeset/ renders the tip changeset
128
129 $ request json-rev
130 200 Script output follows
131
132 "not yet implemented"
133
134 changeset/{revision} shows tags
135
136 $ request json-rev/78896eb0e102
137 200 Script output follows
138
139 "not yet implemented"
140
141 changeset/{revision} shows bookmarks
142
143 $ request json-rev/8d7c456572ac
144 200 Script output follows
145
146 "not yet implemented"
147
148 changeset/{revision} shows branches
149
150 $ request json-rev/6ab967a8ab34
151 200 Script output follows
152
153 "not yet implemented"
154
155 manifest/{revision}/{path} shows info about a directory at a revision
156
157 $ request json-manifest/06e557f3edf6/
158 200 Script output follows
159
160 "not yet implemented"
161
162 tags/ shows tags info
163
164 $ request json-tags
165 200 Script output follows
166
167 "not yet implemented"
168
169 bookmarks/ shows bookmarks info
170
171 $ request json-bookmarks
172 200 Script output follows
173
174 "not yet implemented"
175
176 branches/ shows branches info
177
178 $ request json-branches
179 200 Script output follows
180
181 "not yet implemented"
182
183 summary/ shows a summary of repository state
184
185 $ request json-summary
186 200 Script output follows
187
188 "not yet implemented"
189
190 filediff/{revision}/{path} shows changes to a file in a revision
191
192 $ request json-diff/f8bbb9024b10/foo
193 200 Script output follows
194
195 "not yet implemented"
196
197 comparison/{revision}/{path} shows information about before and after for a file
198
199 $ request json-comparison/f8bbb9024b10/foo
200 200 Script output follows
201
202 "not yet implemented"
203
204 annotate/{revision}/{path} shows annotations for each line
205
206 $ request json-annotate/f8bbb9024b10/foo
207 200 Script output follows
208
209 "not yet implemented"
210
211 filelog/{revision}/{path} shows history of a single file
212
213 $ request json-filelog/f8bbb9024b10/foo
214 200 Script output follows
215
216 "not yet implemented"
217
218 (archive/ doesn't use templating, so ignore it)
219
220 (static/ doesn't use templating, so ignore it)
221
222 graph/ shows information that can be used to render a graph of the DAG
223
224 $ request json-graph
225 200 Script output follows
226
227 "not yet implemented"
228
229 help/ shows help topics
230
231 $ request json-help
232 200 Script output follows
233
234 "not yet implemented"
235
236 help/{topic} shows an individual help topic
237
238 $ request json-help/phases
239 200 Script output follows
240
241 "not yet implemented"