[PATCH remotenames-ext] bookmarks: adopt the formatter isplain method

Kostia Balytskyi ikostia at fb.com
Mon Oct 3 15:48:09 UTC 2016


# HG changeset patch
# User Kostia Balytskyi <ikostia at fb.com>
# Date 1475508913 25200
#      Mon Oct 03 08:35:13 2016 -0700
# Node ID bc204ce8544ee98aed0119cbf5eec6a3618bf0db
# Parent  e4c0713ea86204b900a2e1cce238f61e4bef2062
bookmarks: adopt the formatter isplain method

Main hg repo changed the way formatter is supposed to be checked for
plainness: previously people would run `if not fm`, thus relying on
`__nonzero__` method, but now there is `isplain` method of formatter.
Remotenames needs to adopt it.

diff --git a/remotenames.py b/remotenames.py
--- a/remotenames.py
+++ b/remotenames.py
@@ -1047,7 +1047,7 @@ def displaylocalbookmarks(ui, repo, opts
     fm = ui.formatter('bookmarks', opts)
     hexfn = fm.hexfunc
     marks = repo._bookmarks
-    if len(marks) == 0 and not fm:
+    if len(marks) == 0 and (not fm or  fm.isplain()):
         ui.status(_("no bookmarks set\n"))
 
     tracking = _readtracking(repo)


More information about the Mercurial-devel mailing list