##// END OF EJS Templates
show: fix corrupt json output with no bookmarks
Ryan McElroy -
r31859:8e282aa3 default
parent child Browse files
Show More
@@ -19,6 +19,7 b' from mercurial import ('
19 cmdutil,
19 cmdutil,
20 commands,
20 commands,
21 error,
21 error,
22 formatter,
22 pycompat,
23 pycompat,
23 registrar,
24 registrar,
24 )
25 )
@@ -109,8 +110,11 b' def showbookmarks(ui, repo, fm):'
109 """bookmarks and their associated changeset"""
110 """bookmarks and their associated changeset"""
110 marks = repo._bookmarks
111 marks = repo._bookmarks
111 if not len(marks):
112 if not len(marks):
112 # TODO json output is corrupted; consider using formatter
113 # This is a bit hacky. Ideally, templates would have a way to
113 ui.write(_('(no bookmarks set)\n'))
114 # specify an empty output, but we shouldn't corrupt JSON while
115 # waiting for this functionality.
116 if not isinstance(fm, formatter.jsonformatter):
117 ui.write(_('(no bookmarks set)\n'))
114 return
118 return
115
119
116 active = repo._activebookmark
120 active = repo._activebookmark
@@ -114,4 +114,12 b' bookmarks JSON works'
114 }
114 }
115 ]
115 ]
116
116
117 JSON works with no bookmarks
118
119 $ hg book -d a-longer-bookmark
120 $ hg book -d book1
121 $ hg show bookmarks -T json
122 [
123 ]
124
117 $ cd ..
125 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now