changeset 11168:6d0d945f9e52

keyword: support extensions using dorecord, e.g. crecord Provide extendable keyword.recordextensions variable, so other extensions beside hgext.record which provide the dorecord function can cooperate with hgext.keyword like so (example from crecord): def extsetup(): try: keyword = extensions.find('keyword') keyword.restricted += ' crecord qcrecord' try: # use record support in keyword.py if present keyword.recordcommands += ' crecord qcrecord' keyword.recordextensions += ' crecord' except AttributeError: pass except KeyError: pass
author Christian Ebert <blacktrash@gmx.net>
date Sun, 09 May 2010 11:14:43 +0200
parents b5ef95b5ae14
children 3d0a9c8d7184
files hgext/keyword.py
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/keyword.py	Wed May 12 14:49:46 2010 -0500
+++ b/hgext/keyword.py	Sun May 09 11:14:43 2010 +0200
@@ -91,6 +91,8 @@
 
 # commands using dorecord
 recordcommands = 'record qrecord'
+# names of extensions using dorecord
+recordextensions = 'record'
 
 # provide cvs-like UTC date filter
 utcdate = lambda x: util.datestr((x[0], 0), '%Y/%m/%d %H:%M:%S')
@@ -515,11 +517,12 @@
         extensions.wrapfunction(patch, 'diff', kw_diff)
     for c in 'annotate changeset rev filediff diff'.split():
         extensions.wrapfunction(webcommands, c, kwweb_skip)
-    try:
-        record = extensions.find('record')
-        extensions.wrapfunction(record, 'dorecord', kw_dorecord)
-    except KeyError:
-        pass
+    for name in recordextensions.split():
+        try:
+            record = extensions.find(name)
+            extensions.wrapfunction(record, 'dorecord', kw_dorecord)
+        except KeyError:
+            pass
 
 cmdtable = {
     'kwdemo':