changeset 3941:2b885ca5afcc stable

templatekw: do not override in-core {obsolete} keyword The extension version uses old API, which will be deprecated in Mercurial 4.8.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 08 Aug 2018 20:21:34 +0900
parents e69ff3ae758c
children 38c9a050ba03 5fade2cb9e00
files hgext3rd/evolve/templatekw.py
diffstat 1 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/templatekw.py	Mon Aug 13 12:55:10 2018 +0200
+++ b/hgext3rd/evolve/templatekw.py	Wed Aug 08 20:21:34 2018 +0900
@@ -26,13 +26,15 @@
 ### template keywords
 # XXX it does not handle troubles well :-/
 
-@eh.templatekw('obsolete')
-def obsoletekw(repo, ctx, templ, **args):
-    """String. Whether the changeset is ``obsolete``.
-    """
-    if ctx.obsolete():
-        return 'obsolete'
-    return ''
+if not util.safehasattr(templatekw, 'showobsolete'):
+    # hg < 4.2
+    @eh.templatekw('obsolete')
+    def obsoletekw(repo, ctx, templ, **args):
+        """String. Whether the changeset is ``obsolete``.
+        """
+        if ctx.obsolete():
+            return 'obsolete'
+        return ''
 
 if util.safehasattr(templatekw, 'compatlist'):
     @eh.templatekw('troubles', requires=set(['ctx', 'templ']))