hgext/show.py
changeset 31859 8e282aa3c3ff
parent 31858 ad366d57d574
child 31943 3e9f118cc834
--- a/hgext/show.py	Fri Apr 07 10:26:13 2017 -0700
+++ b/hgext/show.py	Fri Apr 07 10:46:32 2017 -0700
@@ -19,6 +19,7 @@
     cmdutil,
     commands,
     error,
+    formatter,
     pycompat,
     registrar,
 )
@@ -109,8 +110,11 @@
     """bookmarks and their associated changeset"""
     marks = repo._bookmarks
     if not len(marks):
-        # TODO json output is corrupted; consider using formatter
-        ui.write(_('(no bookmarks set)\n'))
+        # This is a bit hacky. Ideally, templates would have a way to
+        # specify an empty output, but we shouldn't corrupt JSON while
+        # waiting for this functionality.
+        if not isinstance(fm, formatter.jsonformatter):
+            ui.write(_('(no bookmarks set)\n'))
         return
 
     active = repo._activebookmark