[PATCH 2 of 3] formatter: add specific check for plain formatting

Mathias De Maré mathias.demare at gmail.com
Mon Aug 29 13:52:42 EDT 2016


# HG changeset patch
# User Mathias De Maré <mathias.demare at gmail.com>
# Date 1472483949 -7200
#      Mon Aug 29 17:19:09 2016 +0200
# Node ID e348c87b33d73a590bee53b74def915b1ce8c6fe
# Parent  fb88d0c87c2746bd84983f1005ed83276c6e9c68
formatter: add specific check for plain formatting

diff --git a/mercurial/formatter.py b/mercurial/formatter.py
--- a/mercurial/formatter.py
+++ b/mercurial/formatter.py
@@ -91,6 +91,9 @@
     def plain(self, text, **opts):
         '''show raw text for non-templated mode'''
         pass
+    def isplain(self):
+        '''check for plain formatter usage'''
+        return False
     def nested(self, field):
         '''sub formatter to store nested data in the specified field'''
         self._item[field] = data = []
@@ -151,6 +154,8 @@
             self._ui.write(deftext % fielddata, **opts)
     def plain(self, text, **opts):
         self._ui.write(text, **opts)
+    def isplain(self):
+        return True
     def nested(self, field):
         # nested data will be directly written to ui
         return self


More information about the Mercurial-devel mailing list