# HG changeset patch # User Christian Ebert # Date 1212356852 -7200 # Node ID 10ebb9f44b99ea166ac33e1cfa039575f802c564 # Parent f83dd10a4d248bcd86cd75088afe6fadb9016650 keyword: monkeypatch dispatch._runcommand instead of _parse We want the current command, and hooking into this method makes it more transparent what we are doing. diff -r f83dd10a4d24 -r 10ebb9f44b99 hgkw/keyword.py --- a/hgkw/keyword.py Wed May 14 02:24:40 2008 +0200 +++ b/hgkw/keyword.py Sun Jun 01 23:47:32 2008 +0200 @@ -410,7 +410,7 @@ def uisetup(ui): '''Collects [keyword] config in kwtools. - Monkeypatches dispatch._parse if needed.''' + Monkeypatch dispatch._runcommand if needed to grab command for kwtools.''' for pat, opt in ui.configitems('keyword'): if opt != 'ignore': @@ -419,14 +419,12 @@ kwtools['exc'].append(pat) if kwtools['inc']: - def kwdispatch_parse(ui, args): - '''Monkeypatch dispatch._parse to obtain running hg command.''' - cmd, func, args, options, cmdoptions = dispatch_parse(ui, args) + def kwdispatch_runcommand(ui, options, cmd, cmdfunc): kwtools['hgcmd'] = cmd - return cmd, func, args, options, cmdoptions + return dispatch_runcommand(ui, options, cmd, cmdfunc) - dispatch_parse = dispatch._parse - dispatch._parse = kwdispatch_parse + dispatch_runcommand = dispatch._runcommand + dispatch._runcommand = kwdispatch_runcommand def reposetup(ui, repo): '''Sets up repo as kwrepo for keyword substitution.