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

login
register
mail settings
Submitter Kostia Balytskyi
Date Oct. 3, 2016, 3:48 p.m.
Message ID <bc204ce8544ee98aed01.1475509689@dev1902.lla1.facebook.com>
Download mbox | patch
Permalink /patch/16832/
State Superseded
Headers show

Comments

Kostia Balytskyi - Oct. 3, 2016, 3:48 p.m.
# HG changeset patch
# User Kostia Balytskyi <ikostia@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.
Sean Farley - Oct. 3, 2016, 10:29 p.m.
Kostia Balytskyi <ikostia@fb.com> writes:

> # HG changeset patch
> # User Kostia Balytskyi <ikostia@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.

Seems that Ryan already pushed a fix as 4bb9f6b454b4.

Patch

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)