diff hgext/journal.py @ 39720:aa647457df14

journal: use changesetformatter to properly nest list of commits in JSON Before, two separate JSON documents were interleaved. I chose the field name "changesets" over the option name "commits", since each entry is called a "changeset" in log templates.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 03 Sep 2018 20:56:53 +0900
parents 2fb88fa2b337
children c303d65d2e34
line wrap: on
line diff
--- a/hgext/journal.py	Mon Sep 03 07:53:50 2018 +0900
+++ b/hgext/journal.py	Mon Sep 03 20:56:53 2018 +0900
@@ -508,7 +508,11 @@
         fm.write('command', '  %s\n', entry.command)
 
         if opts.get("commits"):
-            displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
+            if fm.isplain():
+                displayer = logcmdutil.changesetdisplayer(ui, repo, opts)
+            else:
+                displayer = logcmdutil.changesetformatter(
+                    ui, repo, fm.nested('changesets'), diffopts=opts)
             for hash in entry.newhashes:
                 try:
                     ctx = repo[hash]