hgext/keyword.py
changeset 8112 6ee71f78497c
parent 8098 6a6ce1df98d2
child 8209 a1a5a57efe90
equal deleted inserted replaced
8111:dbf20df40eb1 8112:6ee71f78497c
    81 '''
    81 '''
    82 
    82 
    83 from mercurial import commands, cmdutil, dispatch, filelog, revlog, extensions
    83 from mercurial import commands, cmdutil, dispatch, filelog, revlog, extensions
    84 from mercurial import patch, localrepo, templater, templatefilters, util
    84 from mercurial import patch, localrepo, templater, templatefilters, util
    85 from mercurial.hgweb import webcommands
    85 from mercurial.hgweb import webcommands
       
    86 from mercurial.lock import release
    86 from mercurial.node import nullid, hex
    87 from mercurial.node import nullid, hex
    87 from mercurial.i18n import _
    88 from mercurial.i18n import _
    88 import re, shutil, tempfile, time
    89 import re, shutil, tempfile, time
    89 
    90 
    90 commands.optionalrepo += ' kwdemo'
    91 commands.optionalrepo += ' kwdemo'
   271     try:
   272     try:
   272         wlock = repo.wlock()
   273         wlock = repo.wlock()
   273         lock = repo.lock()
   274         lock = repo.lock()
   274         kwt.overwrite(None, expand, status[6])
   275         kwt.overwrite(None, expand, status[6])
   275     finally:
   276     finally:
   276         del wlock, lock
   277         release(lock, wlock)
   277 
       
   278 
   278 
   279 def demo(ui, repo, *args, **opts):
   279 def demo(ui, repo, *args, **opts):
   280     '''print [keywordmaps] configuration and an expansion example
   280     '''print [keywordmaps] configuration and an expansion example
   281 
   281 
   282     Show current, custom, or default keyword template maps and their
   282     Show current, custom, or default keyword template maps and their
   485                 if n is not None:
   485                 if n is not None:
   486                     kwt.overwrite(n, True, None)
   486                     kwt.overwrite(n, True, None)
   487                     repo.hook('commit', node=n, parent1=_p1, parent2=_p2)
   487                     repo.hook('commit', node=n, parent1=_p1, parent2=_p2)
   488                 return n
   488                 return n
   489             finally:
   489             finally:
   490                 del wlock, lock
   490                 release(lock, wlock)
   491 
   491 
   492     # monkeypatches
   492     # monkeypatches
   493     def kwpatchfile_init(orig, self, ui, fname, opener, missing=False):
   493     def kwpatchfile_init(orig, self, ui, fname, opener, missing=False):
   494         '''Monkeypatch/wrap patch.patchfile.__init__ to avoid
   494         '''Monkeypatch/wrap patch.patchfile.__init__ to avoid
   495         rejects or conflicts due to expanded keywords in working dir.'''
   495         rejects or conflicts due to expanded keywords in working dir.'''