##// 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 19 cmdutil,
20 20 commands,
21 21 error,
22 formatter,
22 23 pycompat,
23 24 registrar,
24 25 )
@@ -109,7 +110,10 b' def showbookmarks(ui, repo, fm):'
109 110 """bookmarks and their associated changeset"""
110 111 marks = repo._bookmarks
111 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
114 # specify an empty output, but we shouldn't corrupt JSON while
115 # waiting for this functionality.
116 if not isinstance(fm, formatter.jsonformatter):
113 117 ui.write(_('(no bookmarks set)\n'))
114 118 return
115 119
@@ -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 125 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now