Show More
@@ -0,0 +1,41 b'' | |||||
|
1 | # RelaxNG schema for "xml" log style | |||
|
2 | # Inspired by Subversion's XML log format. | |||
|
3 | ||||
|
4 | start = log | |||
|
5 | node.type = xsd:string {minLength = "40" maxLength = "40"} | |||
|
6 | ||||
|
7 | log = element log { logentry+ } | |||
|
8 | logentry = element logentry { | |||
|
9 | logentry.attlist, | |||
|
10 | branch*, tag*, hgparent*, | |||
|
11 | author, date, | |||
|
12 | msg, paths?, copies?, extra* | |||
|
13 | } | |||
|
14 | logentry.attlist = | |||
|
15 | attribute revision {xsd:nonNegativeInteger} | |||
|
16 | & attribute node {node.type} | |||
|
17 | branch = element branch { text } | |||
|
18 | tag = element tag { text } | |||
|
19 | hgparent = element parent {hgparent.attlist, text} | |||
|
20 | hgparent.attlist = | |||
|
21 | attribute revision {xsd:integer {minInclusive = "-1"} } | |||
|
22 | & attribute node {node.type} | |||
|
23 | author = element author { author.attlist, text } | |||
|
24 | author.attlist = | |||
|
25 | attribute email {text} | |||
|
26 | date = element date {xsd:dateTime} | |||
|
27 | msg = element msg {msg.attlist, text} | |||
|
28 | msg.attlist = | |||
|
29 | attribute xml:space {"preserve"} | |||
|
30 | paths = element paths { path* } | |||
|
31 | path = element path { path.attlist, text } | |||
|
32 | path.attlist = | |||
|
33 | # Action: (A)dd, (M)odify, (R)emove | |||
|
34 | attribute action {"A"|"M"|"R"} | |||
|
35 | copies = element copies { copy+ } | |||
|
36 | copy = element copy { copy.attlist, text } | |||
|
37 | copy.attlist = | |||
|
38 | attribute source {text} | |||
|
39 | extra = element extra {extra.attlist, text} | |||
|
40 | extra.attlist = | |||
|
41 | attribute key {text} |
@@ -844,7 +844,7 b' class changeset_templater(changeset_prin' | |||||
844 | self.ui.write(templater.stringify(self.t(key, **props))) |
|
844 | self.ui.write(templater.stringify(self.t(key, **props))) | |
845 | self.showpatch(ctx.node()) |
|
845 | self.showpatch(ctx.node()) | |
846 |
|
846 | |||
847 |
if types[' |
|
847 | if types['footer']: | |
848 | if not self.footer: |
|
848 | if not self.footer: | |
849 | self.footer = templater.stringify(self.t(types['footer'], |
|
849 | self.footer = templater.stringify(self.t(types['footer'], | |
850 | **props)) |
|
850 | **props)) |
@@ -3,6 +3,7 b" footer = '</log>\\n'" | |||||
3 |
|
3 | |||
4 | changeset = '<logentry revision="{rev}" node="{node}">\n{branches}{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' |
|
4 | changeset = '<logentry revision="{rev}" node="{node}">\n{branches}{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' | |
5 | changeset_verbose = '<logentry revision="{rev}" node="{node}">\n{branches}{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' |
|
5 | changeset_verbose = '<logentry revision="{rev}" node="{node}">\n{branches}{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' | |
|
6 | changeset_debug = '<logentry revision="{rev}" node="{node}">\n{branches}{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' | |||
6 |
|
7 | |||
7 | file_add = '<path action="A">{file_add|xmlescape}</path>\n' |
|
8 | file_add = '<path action="A">{file_add|xmlescape}</path>\n' | |
8 | file_mod = '<path action="M">{file_mod|xmlescape}</path>\n' |
|
9 | file_mod = '<path action="M">{file_mod|xmlescape}</path>\n' | |
@@ -15,3 +16,4 b" end_file_copies = '</copies>\\n'" | |||||
15 | parent = '<parent revision="{rev}" node="{node}" />\n' |
|
16 | parent = '<parent revision="{rev}" node="{node}" />\n' | |
16 | branch = '<branch>{branch|xmlescape}</branch>\n' |
|
17 | branch = '<branch>{branch|xmlescape}</branch>\n' | |
17 | tag = '<tag>{tag|xmlescape}</tag>\n' |
|
18 | tag = '<tag>{tag|xmlescape}</tag>\n' | |
|
19 | extra = '<extra key="{key|xmlescape}">{value|xmlescape}</extra>\n' |
@@ -203,7 +203,7 b' def find_exe(command):' | |||||
203 | executable = findexisting(os.path.join(path, command)) |
|
203 | executable = findexisting(os.path.join(path, command)) | |
204 | if executable is not None: |
|
204 | if executable is not None: | |
205 | return executable |
|
205 | return executable | |
206 | return None |
|
206 | return findexisting(os.path.expanduser(os.path.expandvars(command))) | |
207 |
|
207 | |||
208 | def set_signal_handler(): |
|
208 | def set_signal_handler(): | |
209 | try: |
|
209 | try: |
@@ -62,6 +62,14 b' hg log --style compact' | |||||
62 | hg log -v --style compact |
|
62 | hg log -v --style compact | |
63 | hg log --debug --style compact |
|
63 | hg log --debug --style compact | |
64 |
|
64 | |||
|
65 | # Test xml styles | |||
|
66 | echo '# xml style works (--style xml)' | |||
|
67 | hg log --style xml | |||
|
68 | echo '# xml style works (-v --style xml)' | |||
|
69 | hg log -v --style xml | |||
|
70 | echo '# xml style works (--debug --style xml)' | |||
|
71 | hg log --debug --style xml | |||
|
72 | ||||
65 | echo '# error if style not readable' |
|
73 | echo '# error if style not readable' | |
66 | touch q |
|
74 | touch q | |
67 | chmod 0 q |
|
75 | chmod 0 q |
@@ -97,6 +97,266 b' 0:-1,-1 1e4e1b8f71e0 1970-01-12 13:4' | |||||
97 | line 1 |
|
97 | line 1 | |
98 | line 2 |
|
98 | line 2 | |
99 |
|
99 | |||
|
100 | # xml style works (--style xml) | |||
|
101 | <?xml version="1.0"?> | |||
|
102 | <log> | |||
|
103 | <logentry revision="8" node="3bdecc1cde0c3d5fa6eaee3d9d9828f6ac468d57"> | |||
|
104 | <tag>tip</tag> | |||
|
105 | <author email="test">test</author> | |||
|
106 | <date>2020-01-01T10:01:00+00:00</date> | |||
|
107 | <msg xml:space="preserve">third</msg> | |||
|
108 | </logentry> | |||
|
109 | <logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453"> | |||
|
110 | <parent revision="-1" node="0000000000000000000000000000000000000000" /> | |||
|
111 | <author email="user@hostname">User Name</author> | |||
|
112 | <date>1970-01-12T13:46:40+00:00</date> | |||
|
113 | <msg xml:space="preserve">second</msg> | |||
|
114 | </logentry> | |||
|
115 | <logentry revision="6" node="c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f"> | |||
|
116 | <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" /> | |||
|
117 | <parent revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4" /> | |||
|
118 | <author email="person">person</author> | |||
|
119 | <date>1970-01-18T08:40:01+00:00</date> | |||
|
120 | <msg xml:space="preserve">merge</msg> | |||
|
121 | </logentry> | |||
|
122 | <logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f"> | |||
|
123 | <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" /> | |||
|
124 | <author email="person">person</author> | |||
|
125 | <date>1970-01-18T08:40:00+00:00</date> | |||
|
126 | <msg xml:space="preserve">new head</msg> | |||
|
127 | </logentry> | |||
|
128 | <logentry revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4"> | |||
|
129 | <branch>foo</branch> | |||
|
130 | <author email="person">person</author> | |||
|
131 | <date>1970-01-17T04:53:20+00:00</date> | |||
|
132 | <msg xml:space="preserve">new branch</msg> | |||
|
133 | </logentry> | |||
|
134 | <logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47"> | |||
|
135 | <author email="person">person</author> | |||
|
136 | <date>1970-01-16T01:06:40+00:00</date> | |||
|
137 | <msg xml:space="preserve">no user, no domain</msg> | |||
|
138 | </logentry> | |||
|
139 | <logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465"> | |||
|
140 | <author email="other@place">other</author> | |||
|
141 | <date>1970-01-14T21:20:00+00:00</date> | |||
|
142 | <msg xml:space="preserve">no person</msg> | |||
|
143 | </logentry> | |||
|
144 | <logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965"> | |||
|
145 | <author email="other@place">A. N. Other</author> | |||
|
146 | <date>1970-01-13T17:33:20+00:00</date> | |||
|
147 | <msg xml:space="preserve">other 1 | |||
|
148 | other 2 | |||
|
149 | ||||
|
150 | other 3</msg> | |||
|
151 | </logentry> | |||
|
152 | <logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f"> | |||
|
153 | <author email="user@hostname">User Name</author> | |||
|
154 | <date>1970-01-12T13:46:40+00:00</date> | |||
|
155 | <msg xml:space="preserve">line 1 | |||
|
156 | line 2</msg> | |||
|
157 | </logentry> | |||
|
158 | </log> | |||
|
159 | # xml style works (-v --style xml) | |||
|
160 | <?xml version="1.0"?> | |||
|
161 | <log> | |||
|
162 | <logentry revision="8" node="3bdecc1cde0c3d5fa6eaee3d9d9828f6ac468d57"> | |||
|
163 | <tag>tip</tag> | |||
|
164 | <author email="test">test</author> | |||
|
165 | <date>2020-01-01T10:01:00+00:00</date> | |||
|
166 | <msg xml:space="preserve">third</msg> | |||
|
167 | <paths> | |||
|
168 | <path action="A">fourth</path> | |||
|
169 | <path action="A">third</path> | |||
|
170 | <path action="R">second</path> | |||
|
171 | </paths> | |||
|
172 | <copies> | |||
|
173 | <copy source="second">fourth</copy> | |||
|
174 | </copies> | |||
|
175 | </logentry> | |||
|
176 | <logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453"> | |||
|
177 | <parent revision="-1" node="0000000000000000000000000000000000000000" /> | |||
|
178 | <author email="user@hostname">User Name</author> | |||
|
179 | <date>1970-01-12T13:46:40+00:00</date> | |||
|
180 | <msg xml:space="preserve">second</msg> | |||
|
181 | <paths> | |||
|
182 | <path action="A">second</path> | |||
|
183 | </paths> | |||
|
184 | </logentry> | |||
|
185 | <logentry revision="6" node="c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f"> | |||
|
186 | <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" /> | |||
|
187 | <parent revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4" /> | |||
|
188 | <author email="person">person</author> | |||
|
189 | <date>1970-01-18T08:40:01+00:00</date> | |||
|
190 | <msg xml:space="preserve">merge</msg> | |||
|
191 | <paths> | |||
|
192 | </paths> | |||
|
193 | </logentry> | |||
|
194 | <logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f"> | |||
|
195 | <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" /> | |||
|
196 | <author email="person">person</author> | |||
|
197 | <date>1970-01-18T08:40:00+00:00</date> | |||
|
198 | <msg xml:space="preserve">new head</msg> | |||
|
199 | <paths> | |||
|
200 | <path action="A">d</path> | |||
|
201 | </paths> | |||
|
202 | </logentry> | |||
|
203 | <logentry revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4"> | |||
|
204 | <branch>foo</branch> | |||
|
205 | <author email="person">person</author> | |||
|
206 | <date>1970-01-17T04:53:20+00:00</date> | |||
|
207 | <msg xml:space="preserve">new branch</msg> | |||
|
208 | <paths> | |||
|
209 | </paths> | |||
|
210 | </logentry> | |||
|
211 | <logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47"> | |||
|
212 | <author email="person">person</author> | |||
|
213 | <date>1970-01-16T01:06:40+00:00</date> | |||
|
214 | <msg xml:space="preserve">no user, no domain</msg> | |||
|
215 | <paths> | |||
|
216 | <path action="M">c</path> | |||
|
217 | </paths> | |||
|
218 | </logentry> | |||
|
219 | <logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465"> | |||
|
220 | <author email="other@place">other</author> | |||
|
221 | <date>1970-01-14T21:20:00+00:00</date> | |||
|
222 | <msg xml:space="preserve">no person</msg> | |||
|
223 | <paths> | |||
|
224 | <path action="A">c</path> | |||
|
225 | </paths> | |||
|
226 | </logentry> | |||
|
227 | <logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965"> | |||
|
228 | <author email="other@place">A. N. Other</author> | |||
|
229 | <date>1970-01-13T17:33:20+00:00</date> | |||
|
230 | <msg xml:space="preserve">other 1 | |||
|
231 | other 2 | |||
|
232 | ||||
|
233 | other 3</msg> | |||
|
234 | <paths> | |||
|
235 | <path action="A">b</path> | |||
|
236 | </paths> | |||
|
237 | </logentry> | |||
|
238 | <logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f"> | |||
|
239 | <author email="user@hostname">User Name</author> | |||
|
240 | <date>1970-01-12T13:46:40+00:00</date> | |||
|
241 | <msg xml:space="preserve">line 1 | |||
|
242 | line 2</msg> | |||
|
243 | <paths> | |||
|
244 | <path action="A">a</path> | |||
|
245 | </paths> | |||
|
246 | </logentry> | |||
|
247 | </log> | |||
|
248 | # xml style works (--debug --style xml) | |||
|
249 | <?xml version="1.0"?> | |||
|
250 | <log> | |||
|
251 | <logentry revision="8" node="3bdecc1cde0c3d5fa6eaee3d9d9828f6ac468d57"> | |||
|
252 | <tag>tip</tag> | |||
|
253 | <parent revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453" /> | |||
|
254 | <parent revision="-1" node="0000000000000000000000000000000000000000" /> | |||
|
255 | <author email="test">test</author> | |||
|
256 | <date>2020-01-01T10:01:00+00:00</date> | |||
|
257 | <msg xml:space="preserve">third</msg> | |||
|
258 | <paths> | |||
|
259 | <path action="A">fourth</path> | |||
|
260 | <path action="A">third</path> | |||
|
261 | <path action="R">second</path> | |||
|
262 | </paths> | |||
|
263 | <copies> | |||
|
264 | <copy source="second">fourth</copy> | |||
|
265 | </copies> | |||
|
266 | <extra key="branch">default</extra> | |||
|
267 | </logentry> | |||
|
268 | <logentry revision="7" node="29114dbae42b9f078cf2714dbe3a86bba8ec7453"> | |||
|
269 | <parent revision="-1" node="0000000000000000000000000000000000000000" /> | |||
|
270 | <parent revision="-1" node="0000000000000000000000000000000000000000" /> | |||
|
271 | <author email="user@hostname">User Name</author> | |||
|
272 | <date>1970-01-12T13:46:40+00:00</date> | |||
|
273 | <msg xml:space="preserve">second</msg> | |||
|
274 | <paths> | |||
|
275 | <path action="A">second</path> | |||
|
276 | </paths> | |||
|
277 | <extra key="branch">default</extra> | |||
|
278 | </logentry> | |||
|
279 | <logentry revision="6" node="c7b487c6c50ef1cf464cafdc4f4f5e615fc5999f"> | |||
|
280 | <parent revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f" /> | |||
|
281 | <parent revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4" /> | |||
|
282 | <author email="person">person</author> | |||
|
283 | <date>1970-01-18T08:40:01+00:00</date> | |||
|
284 | <msg xml:space="preserve">merge</msg> | |||
|
285 | <paths> | |||
|
286 | </paths> | |||
|
287 | <extra key="branch">default</extra> | |||
|
288 | </logentry> | |||
|
289 | <logentry revision="5" node="13207e5a10d9fd28ec424934298e176197f2c67f"> | |||
|
290 | <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" /> | |||
|
291 | <parent revision="-1" node="0000000000000000000000000000000000000000" /> | |||
|
292 | <author email="person">person</author> | |||
|
293 | <date>1970-01-18T08:40:00+00:00</date> | |||
|
294 | <msg xml:space="preserve">new head</msg> | |||
|
295 | <paths> | |||
|
296 | <path action="A">d</path> | |||
|
297 | </paths> | |||
|
298 | <extra key="branch">default</extra> | |||
|
299 | </logentry> | |||
|
300 | <logentry revision="4" node="32a18f097fcccf76ef282f62f8a85b3adf8d13c4"> | |||
|
301 | <branch>foo</branch> | |||
|
302 | <parent revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47" /> | |||
|
303 | <parent revision="-1" node="0000000000000000000000000000000000000000" /> | |||
|
304 | <author email="person">person</author> | |||
|
305 | <date>1970-01-17T04:53:20+00:00</date> | |||
|
306 | <msg xml:space="preserve">new branch</msg> | |||
|
307 | <paths> | |||
|
308 | </paths> | |||
|
309 | <extra key="branch">foo</extra> | |||
|
310 | </logentry> | |||
|
311 | <logentry revision="3" node="10e46f2dcbf4823578cf180f33ecf0b957964c47"> | |||
|
312 | <parent revision="2" node="97054abb4ab824450e9164180baf491ae0078465" /> | |||
|
313 | <parent revision="-1" node="0000000000000000000000000000000000000000" /> | |||
|
314 | <author email="person">person</author> | |||
|
315 | <date>1970-01-16T01:06:40+00:00</date> | |||
|
316 | <msg xml:space="preserve">no user, no domain</msg> | |||
|
317 | <paths> | |||
|
318 | <path action="M">c</path> | |||
|
319 | </paths> | |||
|
320 | <extra key="branch">default</extra> | |||
|
321 | </logentry> | |||
|
322 | <logentry revision="2" node="97054abb4ab824450e9164180baf491ae0078465"> | |||
|
323 | <parent revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965" /> | |||
|
324 | <parent revision="-1" node="0000000000000000000000000000000000000000" /> | |||
|
325 | <author email="other@place">other</author> | |||
|
326 | <date>1970-01-14T21:20:00+00:00</date> | |||
|
327 | <msg xml:space="preserve">no person</msg> | |||
|
328 | <paths> | |||
|
329 | <path action="A">c</path> | |||
|
330 | </paths> | |||
|
331 | <extra key="branch">default</extra> | |||
|
332 | </logentry> | |||
|
333 | <logentry revision="1" node="b608e9d1a3f0273ccf70fb85fd6866b3482bf965"> | |||
|
334 | <parent revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f" /> | |||
|
335 | <parent revision="-1" node="0000000000000000000000000000000000000000" /> | |||
|
336 | <author email="other@place">A. N. Other</author> | |||
|
337 | <date>1970-01-13T17:33:20+00:00</date> | |||
|
338 | <msg xml:space="preserve">other 1 | |||
|
339 | other 2 | |||
|
340 | ||||
|
341 | other 3</msg> | |||
|
342 | <paths> | |||
|
343 | <path action="A">b</path> | |||
|
344 | </paths> | |||
|
345 | <extra key="branch">default</extra> | |||
|
346 | </logentry> | |||
|
347 | <logentry revision="0" node="1e4e1b8f71e05681d422154f5421e385fec3454f"> | |||
|
348 | <parent revision="-1" node="0000000000000000000000000000000000000000" /> | |||
|
349 | <parent revision="-1" node="0000000000000000000000000000000000000000" /> | |||
|
350 | <author email="user@hostname">User Name</author> | |||
|
351 | <date>1970-01-12T13:46:40+00:00</date> | |||
|
352 | <msg xml:space="preserve">line 1 | |||
|
353 | line 2</msg> | |||
|
354 | <paths> | |||
|
355 | <path action="A">a</path> | |||
|
356 | </paths> | |||
|
357 | <extra key="branch">default</extra> | |||
|
358 | </logentry> | |||
|
359 | </log> | |||
100 | # error if style not readable |
|
360 | # error if style not readable | |
101 | abort: Permission denied: ./q |
|
361 | abort: Permission denied: ./q | |
102 | # error if no style |
|
362 | # error if no style |
General Comments 0
You need to be logged in to leave comments.
Login now