hgext/keyword.py
changeset 16810 846607ff274f
parent 16809 6b704fa2bea1
child 16811 f8c495cc6313
equal deleted inserted replaced
16809:6b704fa2bea1 16810:846607ff274f
   623     def kwweb_skip(orig, web, req, tmpl):
   623     def kwweb_skip(orig, web, req, tmpl):
   624         '''Wraps webcommands.x turning off keyword expansion.'''
   624         '''Wraps webcommands.x turning off keyword expansion.'''
   625         kwt.match = util.never
   625         kwt.match = util.never
   626         return orig(web, req, tmpl)
   626         return orig(web, req, tmpl)
   627 
   627 
       
   628     def kw_amend(orig, ui, repo, commitfunc, old, extra, pats, opts):
       
   629         '''Wraps cmdutil.amend expanding keywords after amend.'''
       
   630         wlock = repo.wlock()
       
   631         try:
       
   632             kwt.postcommit = True
       
   633             newid = orig(ui, repo, commitfunc, old, extra, pats, opts)
       
   634             if newid != old.node():
       
   635                 ctx = repo[newid]
       
   636                 kwt.restrict = True
       
   637                 kwt.overwrite(ctx, ctx.files(), False, True)
       
   638                 kwt.restrict = False
       
   639             return newid
       
   640         finally:
       
   641             wlock.release()
       
   642 
   628     def kw_copy(orig, ui, repo, pats, opts, rename=False):
   643     def kw_copy(orig, ui, repo, pats, opts, rename=False):
   629         '''Wraps cmdutil.copy so that copy/rename destinations do not
   644         '''Wraps cmdutil.copy so that copy/rename destinations do not
   630         contain expanded keywords.
   645         contain expanded keywords.
   631         Note that the source of a regular file destination may also be a
   646         Note that the source of a regular file destination may also be a
   632         symlink:
   647         symlink:
   688         return True
   703         return True
   689 
   704 
   690     extensions.wrapfunction(context.filectx, 'cmp', kwfilectx_cmp)
   705     extensions.wrapfunction(context.filectx, 'cmp', kwfilectx_cmp)
   691     extensions.wrapfunction(patch.patchfile, '__init__', kwpatchfile_init)
   706     extensions.wrapfunction(patch.patchfile, '__init__', kwpatchfile_init)
   692     extensions.wrapfunction(patch, 'diff', kw_diff)
   707     extensions.wrapfunction(patch, 'diff', kw_diff)
       
   708     extensions.wrapfunction(cmdutil, 'amend', kw_amend)
   693     extensions.wrapfunction(cmdutil, 'copy', kw_copy)
   709     extensions.wrapfunction(cmdutil, 'copy', kw_copy)
   694     for c in 'annotate changeset rev filediff diff'.split():
   710     for c in 'annotate changeset rev filediff diff'.split():
   695         extensions.wrapfunction(webcommands, c, kwweb_skip)
   711         extensions.wrapfunction(webcommands, c, kwweb_skip)
   696     for name in recordextensions.split():
   712     for name in recordextensions.split():
   697         try:
   713         try: