diff mercurial/bookmarks.py @ 39746:25cc5616adc9

bookmarks: pass in formatter to printbookmarks() instead of opts (API) This clarifies that user options have to be processed before calling printbookmarks().
author Yuya Nishihara <yuya@tcha.org>
date Sat, 15 Sep 2018 11:50:07 +0900
parents 713085b45810
children b05b4b91de3d
line wrap: on
line diff
--- a/mercurial/bookmarks.py	Wed Sep 19 17:09:01 2018 +0200
+++ b/mercurial/bookmarks.py	Sat Sep 15 11:50:07 2018 +0900
@@ -915,14 +915,12 @@
     elif cur != tgt and newact == repo._activebookmark:
         deactivate(repo)
 
-def _printbookmarks(ui, repo, bmarks, **opts):
+def _printbookmarks(ui, repo, fm, bmarks):
     """private method to print bookmarks
 
     Provides a way for extensions to control how bookmarks are printed (e.g.
     prepend or postpend names)
     """
-    opts = pycompat.byteskwargs(opts)
-    fm = ui.formatter('bookmarks', opts)
     hexfn = fm.hexfunc
     if len(bmarks) == 0 and fm.isplain():
         ui.status(_("no bookmarks set\n"))
@@ -937,10 +935,9 @@
                      repo.changelog.rev(n), hexfn(n), label=label)
         fm.data(active=(activebookmarklabel in label))
         fm.plain('\n')
-    fm.end()
 
-def printbookmarks(ui, repo, **opts):
-    """print bookmarks to a formatter
+def printbookmarks(ui, repo, fm):
+    """print bookmarks by the given formatter
 
     Provides a way for extensions to control how bookmarks are printed.
     """
@@ -954,7 +951,7 @@
             prefix, label = ' ', ''
 
         bmarks[bmark] = (n, prefix, label)
-    _printbookmarks(ui, repo, bmarks, **opts)
+    _printbookmarks(ui, repo, fm, bmarks)
 
 def preparehookargs(name, old, new):
     if new is None: