Mercurial > hg
comparison hgext/keyword.py @ 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 | 871088c223ec |
children | 687c7d395f20 |
comparison
equal
deleted
inserted
replaced
11167:b5ef95b5ae14 | 11168:6d0d945f9e52 |
---|---|
89 # not when reading filelog, and unexpand when reading from working dir | 89 # not when reading filelog, and unexpand when reading from working dir |
90 restricted = 'merge record qrecord resolve transplant' | 90 restricted = 'merge record qrecord resolve transplant' |
91 | 91 |
92 # commands using dorecord | 92 # commands using dorecord |
93 recordcommands = 'record qrecord' | 93 recordcommands = 'record qrecord' |
94 # names of extensions using dorecord | |
95 recordextensions = 'record' | |
94 | 96 |
95 # provide cvs-like UTC date filter | 97 # provide cvs-like UTC date filter |
96 utcdate = lambda x: util.datestr((x[0], 0), '%Y/%m/%d %H:%M:%S') | 98 utcdate = lambda x: util.datestr((x[0], 0), '%Y/%m/%d %H:%M:%S') |
97 | 99 |
98 # make keyword tools accessible | 100 # make keyword tools accessible |
513 extensions.wrapfunction(patch.patchfile, '__init__', kwpatchfile_init) | 515 extensions.wrapfunction(patch.patchfile, '__init__', kwpatchfile_init) |
514 if not kwt.restrict: | 516 if not kwt.restrict: |
515 extensions.wrapfunction(patch, 'diff', kw_diff) | 517 extensions.wrapfunction(patch, 'diff', kw_diff) |
516 for c in 'annotate changeset rev filediff diff'.split(): | 518 for c in 'annotate changeset rev filediff diff'.split(): |
517 extensions.wrapfunction(webcommands, c, kwweb_skip) | 519 extensions.wrapfunction(webcommands, c, kwweb_skip) |
518 try: | 520 for name in recordextensions.split(): |
519 record = extensions.find('record') | 521 try: |
520 extensions.wrapfunction(record, 'dorecord', kw_dorecord) | 522 record = extensions.find(name) |
521 except KeyError: | 523 extensions.wrapfunction(record, 'dorecord', kw_dorecord) |
522 pass | 524 except KeyError: |
525 pass | |
523 | 526 |
524 cmdtable = { | 527 cmdtable = { |
525 'kwdemo': | 528 'kwdemo': |
526 (demo, | 529 (demo, |
527 [('d', 'default', None, _('show default keyword template maps')), | 530 [('d', 'default', None, _('show default keyword template maps')), |