obslog: make reason for unavailable patch part of template
authorMartin von Zweigbergk <martinvonz@google.com>
Thu, 07 Nov 2019 22:24:50 -0800
changeset 4947 0ad2000854c4
parent 4946 bd992b1d4426
child 4948 069cfc5301fb
obslog: make reason for unavailable patch part of template We need the reason to be in the template in order to be able to templatize the whole output.
hgext3rd/evolve/obshistory.py
--- a/hgext3rd/evolve/obshistory.py	Thu Nov 07 16:34:01 2019 -0800
+++ b/hgext3rd/evolve/obshistory.py	Thu Nov 07 22:24:50 2019 -0800
@@ -622,10 +622,8 @@
                 ui.write(chunk, label=label)
             fm.write(b'patch', b'%s', ui.popbuffer())
         else:
-            nopatch = b"    (No patch available, %s)" % _patchavailable[1]
-            fm.plain(b"\n")
-            # TODO: should be in json too
-            fm.plain(nopatch)
+            fm.write(b'nopatchreason', b"\n    (No patch available, %s)",
+                     _patchavailable[1])
 
     fm.plain(b"\n")
 
@@ -766,10 +764,8 @@
                 ui.write(chunk, label=label)
             fm.write(b'patch', b'%s', ui.popbuffer())
         else:
-            nopatch = b"    (No patch available, %s)" % _patchavailable[1]
-            fm.plain(b"\n")
-            # TODO: should be in json too
-            fm.plain(nopatch)
+            fm.write(b'nopatchreason', b"\n    (No patch available, %s)",
+                     _patchavailable[1])
 
     fm.plain(b"\n")