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 Monkeypatches dispatch._parse if needed.''' |
413 Monkeypatch dispatch._runcommand if needed to grab command for kwtools.''' |
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_parse(ui, args): |
422 def kwdispatch_runcommand(ui, options, cmd, cmdfunc): |
423 '''Monkeypatch dispatch._parse to obtain running hg command.''' |
|
424 cmd, func, args, options, cmdoptions = dispatch_parse(ui, args) |
|
425 kwtools['hgcmd'] = cmd |
423 kwtools['hgcmd'] = cmd |
426 return cmd, func, args, options, cmdoptions |
424 return dispatch_runcommand(ui, options, cmd, cmdfunc) |
427 |
425 |
428 dispatch_parse = dispatch._parse |
426 dispatch_runcommand = dispatch._runcommand |
429 dispatch._parse = kwdispatch_parse |
427 dispatch._runcommand = kwdispatch_runcommand |
430 |
428 |
431 def reposetup(ui, repo): |
429 def reposetup(ui, repo): |
432 '''Sets up repo as kwrepo for keyword substitution. |
430 '''Sets up repo as kwrepo for keyword substitution. |
433 Overrides file method to return kwfilelog instead of filelog |
431 Overrides file method to return kwfilelog instead of filelog |
434 if file matches user configuration. |
432 if file matches user configuration. |