##// END OF EJS Templates
journal: use changesetformatter to properly nest list of commits in JSON...
Yuya Nishihara -
r39740:aa647457 default
parent child Browse files
Show More
@@ -508,7 +508,11 b' def journal(ui, repo, *args, **opts):'
508 508 fm.write('command', ' %s\n', entry.command)
509 509
510 510 if opts.get("commits"):
511 displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
511 if fm.isplain():
512 displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
513 else:
514 displayer = logcmdutil.changesetformatter(
515 ui, repo, fm.nested('changesets'), diffopts=opts)
512 516 for hash in entry.newhashes:
513 517 try:
514 518 ctx = repo[hash]
@@ -231,6 +231,62 b' Test that verbose, JSON, template and co'
231 231 summary: a
232 232
233 233
234 $ hg journal --commit -Tjson
235 [
236 {
237 "changesets": [{"bookmarks": ["bar", "baz"], "branch": "default", "date": [0, 0], "desc": "b", "node": "1e6c11564562b4ed919baca798bc4338bd299d6a", "parents": ["cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b"], "phase": "draft", "rev": 1, "tags": ["tip"], "user": "test"}],
238 "command": "up",
239 "date": [5, 0],
240 "name": ".",
241 "newnodes": ["1e6c11564562b4ed919baca798bc4338bd299d6a"],
242 "oldnodes": ["cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b"],
243 "user": "foobar"
244 },
245 {
246 "changesets": [{"bookmarks": [], "branch": "default", "date": [0, 0], "desc": "a", "node": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b", "parents": ["0000000000000000000000000000000000000000"], "phase": "draft", "rev": 0, "tags": [], "user": "test"}],
247 "command": "up 0",
248 "date": [2, 0],
249 "name": ".",
250 "newnodes": ["cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b"],
251 "oldnodes": ["1e6c11564562b4ed919baca798bc4338bd299d6a"],
252 "user": "foobar"
253 },
254 {
255 "changesets": [{"bookmarks": ["bar", "baz"], "branch": "default", "date": [0, 0], "desc": "b", "node": "1e6c11564562b4ed919baca798bc4338bd299d6a", "parents": ["cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b"], "phase": "draft", "rev": 1, "tags": ["tip"], "user": "test"}],
256 "command": "commit -Aqm b",
257 "date": [1, 0],
258 "name": ".",
259 "newnodes": ["1e6c11564562b4ed919baca798bc4338bd299d6a"],
260 "oldnodes": ["cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b"],
261 "user": "foobar"
262 },
263 {
264 "changesets": [{"bookmarks": [], "branch": "default", "date": [0, 0], "desc": "a", "node": "cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b", "parents": ["0000000000000000000000000000000000000000"], "phase": "draft", "rev": 0, "tags": [], "user": "test"}],
265 "command": "commit -Aqm a",
266 "date": [0, 0],
267 "name": ".",
268 "newnodes": ["cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b"],
269 "oldnodes": ["0000000000000000000000000000000000000000"],
270 "user": "foobar"
271 }
272 ]
273
274 $ hg journal --commit \
275 > -T'command: {command}\n{changesets % " rev: {rev}\n children: {children}\n"}'
276 previous locations of '.':
277 command: up
278 rev: 1
279 children:
280 command: up 0
281 rev: 0
282 children:
283 command: commit -Aqm b
284 rev: 1
285 children:
286 command: commit -Aqm a
287 rev: 0
288 children:
289
234 290 Test for behaviour on unexpected storage version information
235 291
236 292 $ printf '42\0' > .hg/namejournal
General Comments 0
You need to be logged in to leave comments. Login now