hgkw/keyword.py
changeset 436 ca455dfc5c80
parent 421 439a24d34a13
child 437 7219104a7cfc
equal deleted inserted replaced
430:15a4c3d86501 436:ca455dfc5c80
   108 
   108 
   109 # store originals of monkeypatches
   109 # store originals of monkeypatches
   110 _patchfile_init = patch.patchfile.__init__
   110 _patchfile_init = patch.patchfile.__init__
   111 _patch_diff = patch.diff
   111 _patch_diff = patch.diff
   112 _dispatch_parse = dispatch._parse
   112 _dispatch_parse = dispatch._parse
       
   113 _webcommands_changeset = webcommands.changeset
       
   114 _webcommands_filediff = webcommands.filediff
   113 
   115 
   114 def _kwpatchfile_init(self, ui, fname, missing=False):
   116 def _kwpatchfile_init(self, ui, fname, missing=False):
   115     '''Monkeypatch/wrap patch.patchfile.__init__ to avoid
   117     '''Monkeypatch/wrap patch.patchfile.__init__ to avoid
   116     rejects or conflicts due to expanded keywords in working dir.'''
   118     rejects or conflicts due to expanded keywords in working dir.'''
   117     _patchfile_init(self, ui, fname, missing=missing)
   119     _patchfile_init(self, ui, fname, missing=missing)
   131                 fp=fp, changes=changes, opts=opts)
   133                 fp=fp, changes=changes, opts=opts)
   132 
   134 
   133 def _kwweb_changeset(web, req, tmpl):
   135 def _kwweb_changeset(web, req, tmpl):
   134     '''Wraps webcommands.changeset turning off keyword expansion.'''
   136     '''Wraps webcommands.changeset turning off keyword expansion.'''
   135     kwtools['templater'].matcher = util.never
   137     kwtools['templater'].matcher = util.never
   136     return web.changeset(tmpl, web.changectx(req))
   138     return _webcommands_changeset(web, req, tmpl)
   137 
   139 
   138 def _kwweb_filediff(web, req, tmpl):
   140 def _kwweb_filediff(web, req, tmpl):
   139     '''Wraps webcommands.filediff turning off keyword expansion.'''
   141     '''Wraps webcommands.filediff turning off keyword expansion.'''
   140     kwtools['templater'].matcher = util.never
   142     kwtools['templater'].matcher = util.never
   141     return web.filediff(tmpl, web.filectx(req))
   143     return _webcommands_filediff(web, req, tmpl)
   142 
   144 
   143 def _kwdispatch_parse(ui, args):
   145 def _kwdispatch_parse(ui, args):
   144     '''Monkeypatch dispatch._parse to obtain running hg command.'''
   146     '''Monkeypatch dispatch._parse to obtain running hg command.'''
   145     cmd, func, args, options, cmdoptions = _dispatch_parse(ui, args)
   147     cmd, func, args, options, cmdoptions = _dispatch_parse(ui, args)
   146     kwtools['hgcmd'] = cmd
   148     kwtools['hgcmd'] = cmd
   147     return cmd, func, args, options, cmdoptions
   149     return cmd, func, args, options, cmdoptions
   148 
   150 
   149 # dispatch._parse is run before reposetup, so wrap it here
   151 # dispatch._parse is run before reposetup, so wrap it here
       
   152 # all other actual monkey patching is done at end of reposetup
   150 dispatch._parse = _kwdispatch_parse
   153 dispatch._parse = _kwdispatch_parse
   151 
   154 
   152 
   155 
   153 class kwtemplater(object):
   156 class kwtemplater(object):
   154     '''
   157     '''