##// END OF EJS Templates
bookmarks: pass in formatter to printbookmarks() instead of opts (API)...
Yuya Nishihara -
r39782:25cc5616 default
parent child Browse files
Show More
@@ -230,7 +230,7 b' class remotenames(object):'
230 230 self._nodetohoists.setdefault(node[0], []).append(name)
231 231 return self._nodetohoists
232 232
233 def wrapprintbookmarks(orig, ui, repo, bmarks, **opts):
233 def wrapprintbookmarks(orig, ui, repo, fm, bmarks):
234 234 if 'remotebookmarks' not in repo.names:
235 235 return
236 236 ns = repo.names['remotebookmarks']
@@ -243,7 +243,7 b' def wrapprintbookmarks(orig, ui, repo, b'
243 243
244 244 bmarks[name] = (node, ' ', '')
245 245
246 return orig(ui, repo, bmarks, **opts)
246 return orig(ui, repo, fm, bmarks)
247 247
248 248 def extsetup(ui):
249 249 extensions.wrapfunction(bookmarks, '_printbookmarks', wrapprintbookmarks)
@@ -915,14 +915,12 b' def addbookmarks(repo, tr, names, rev=No'
915 915 elif cur != tgt and newact == repo._activebookmark:
916 916 deactivate(repo)
917 917
918 def _printbookmarks(ui, repo, bmarks, **opts):
918 def _printbookmarks(ui, repo, fm, bmarks):
919 919 """private method to print bookmarks
920 920
921 921 Provides a way for extensions to control how bookmarks are printed (e.g.
922 922 prepend or postpend names)
923 923 """
924 opts = pycompat.byteskwargs(opts)
925 fm = ui.formatter('bookmarks', opts)
926 924 hexfn = fm.hexfunc
927 925 if len(bmarks) == 0 and fm.isplain():
928 926 ui.status(_("no bookmarks set\n"))
@@ -937,10 +935,9 b' def _printbookmarks(ui, repo, bmarks, **'
937 935 repo.changelog.rev(n), hexfn(n), label=label)
938 936 fm.data(active=(activebookmarklabel in label))
939 937 fm.plain('\n')
940 fm.end()
941 938
942 def printbookmarks(ui, repo, **opts):
943 """print bookmarks to a formatter
939 def printbookmarks(ui, repo, fm):
940 """print bookmarks by the given formatter
944 941
945 942 Provides a way for extensions to control how bookmarks are printed.
946 943 """
@@ -954,7 +951,7 b' def printbookmarks(ui, repo, **opts):'
954 951 prefix, label = ' ', ''
955 952
956 953 bmarks[bmark] = (n, prefix, label)
957 _printbookmarks(ui, repo, bmarks, **opts)
954 _printbookmarks(ui, repo, fm, bmarks)
958 955
959 956 def preparehookargs(name, old, new):
960 957 if new is None:
@@ -1011,7 +1011,9 b' def bookmark(ui, repo, *names, **opts):'
1011 1011 return 1
1012 1012 ui.write("%s\n" % book, label=bookmarks.activebookmarklabel)
1013 1013 else: # show bookmarks
1014 bookmarks.printbookmarks(ui, repo, **opts)
1014 opts = pycompat.byteskwargs(opts)
1015 with ui.formatter('bookmarks', opts) as fm:
1016 bookmarks.printbookmarks(ui, repo, fm)
1015 1017
1016 1018 @command('branch',
1017 1019 [('f', 'force', None,
General Comments 0
You need to be logged in to leave comments. Login now