hgext/convert/__init__.py
changeset 36514 7b74afec6772
parent 35036 281214150561
child 37658 34758397ad1b
--- a/hgext/convert/__init__.py	Sun Feb 25 14:28:32 2018 +0900
+++ b/hgext/convert/__init__.py	Sun Feb 25 13:40:46 2018 +0900
@@ -477,7 +477,8 @@
     dates.'''
     return cvsps.debugcvsps(ui, *args, **opts)
 
-def kwconverted(ctx, name):
+def kwconverted(context, mapping, name):
+    ctx = context.resource(mapping, 'ctx')
     rev = ctx.extra().get('convert_revision', '')
     if rev.startswith('svn:'):
         if name == 'svnrev':
@@ -490,20 +491,20 @@
 
 templatekeyword = registrar.templatekeyword()
 
-@templatekeyword('svnrev')
-def kwsvnrev(repo, ctx, **args):
+@templatekeyword('svnrev', requires={'ctx'})
+def kwsvnrev(context, mapping):
     """String. Converted subversion revision number."""
-    return kwconverted(ctx, 'svnrev')
+    return kwconverted(context, mapping, 'svnrev')
 
-@templatekeyword('svnpath')
-def kwsvnpath(repo, ctx, **args):
+@templatekeyword('svnpath', requires={'ctx'})
+def kwsvnpath(context, mapping):
     """String. Converted subversion revision project path."""
-    return kwconverted(ctx, 'svnpath')
+    return kwconverted(context, mapping, 'svnpath')
 
-@templatekeyword('svnuuid')
-def kwsvnuuid(repo, ctx, **args):
+@templatekeyword('svnuuid', requires={'ctx'})
+def kwsvnuuid(context, mapping):
     """String. Converted subversion revision repository identifier."""
-    return kwconverted(ctx, 'svnuuid')
+    return kwconverted(context, mapping, 'svnuuid')
 
 # tell hggettext to extract docstrings from these functions:
 i18nfunctions = [kwsvnrev, kwsvnpath, kwsvnuuid]