408 _kwfwrite(ui, repo, False, *pats, **opts) |
408 _kwfwrite(ui, repo, False, *pats, **opts) |
409 |
409 |
410 |
410 |
411 def uisetup(ui): |
411 def uisetup(ui): |
412 '''Collects [keyword] config in kwtools. |
412 '''Collects [keyword] config in kwtools. |
413 Monkeypatch dispatch._runcommand if needed to grab command for kwtools.''' |
413 Monkeypatches dispatch._parse if needed.''' |
414 |
414 |
415 for pat, opt in ui.configitems('keyword'): |
415 for pat, opt in ui.configitems('keyword'): |
416 if opt != 'ignore': |
416 if opt != 'ignore': |
417 kwtools['inc'].append(pat) |
417 kwtools['inc'].append(pat) |
418 else: |
418 else: |
419 kwtools['exc'].append(pat) |
419 kwtools['exc'].append(pat) |
420 |
420 |
421 if kwtools['inc']: |
421 if kwtools['inc']: |
422 def kwdispatch_runcommand(ui, options, cmd, cmdfunc): |
422 def kwdispatch_parse(ui, args): |
|
423 '''Monkeypatch dispatch._parse to obtain running hg command.''' |
|
424 cmd, func, args, options, cmdoptions = dispatch_parse(ui, args) |
423 kwtools['hgcmd'] = cmd |
425 kwtools['hgcmd'] = cmd |
424 return dispatch_runcommand(ui, options, cmd, cmdfunc) |
426 return cmd, func, args, options, cmdoptions |
425 |
427 |
426 dispatch_runcommand = dispatch._runcommand |
428 dispatch_parse = dispatch._parse |
427 dispatch._runcommand = kwdispatch_runcommand |
429 dispatch._parse = kwdispatch_parse |
428 |
430 |
429 def reposetup(ui, repo): |
431 def reposetup(ui, repo): |
430 '''Sets up repo as kwrepo for keyword substitution. |
432 '''Sets up repo as kwrepo for keyword substitution. |
431 Overrides file method to return kwfilelog instead of filelog |
433 Overrides file method to return kwfilelog instead of filelog |
432 if file matches user configuration. |
434 if file matches user configuration. |