hgkw/keyword.py
changeset 240 fb234089cc4c
parent 237 0a0049700af5
child 242 71056c5042de
equal deleted inserted replaced
239:a0b8165fcec9 240:fb234089cc4c
    81 '''
    81 '''
    82 
    82 
    83 from mercurial import commands, cmdutil, context, fancyopts, filelog
    83 from mercurial import commands, cmdutil, context, fancyopts, filelog
    84 from mercurial import localrepo, templater, util, hg
    84 from mercurial import localrepo, templater, util, hg
    85 from mercurial.i18n import gettext as _
    85 from mercurial.i18n import gettext as _
    86 import getopt, re, shutil, sys, tempfile, time
    86 import getopt, os, re, shutil, sys, tempfile, time
    87 
    87 
    88 # backwards compatibility hacks
    88 # backwards compatibility hacks
    89 
    89 
    90 try:
    90 try:
    91     # cmdutil.parse moves to dispatch._parse in 18a9fbb5cd78
    91     # cmdutil.parse moves to dispatch._parse in 18a9fbb5cd78
   332         kwfmatcher = _keywordmatcher(ui, repo)
   332         kwfmatcher = _keywordmatcher(ui, repo)
   333         if kwfmatcher is None:
   333         if kwfmatcher is None:
   334             ui.warn(_('no files configured for keyword expansion\n'))
   334             ui.warn(_('no files configured for keyword expansion\n'))
   335             return
   335             return
   336         man = ctx.manifest()
   336         man = ctx.manifest()
       
   337         if files:
       
   338             cwd = os.getcwd()
       
   339             files = [util.canonpath(repo.root, cwd, f) for f in files]
   337         files = _weedcandidates(man, kwfmatcher, files)
   340         files = _weedcandidates(man, kwfmatcher, files)
   338         if not files:
   341         if not files:
   339             ui.warn(_('files not configured for expansion or untracked\n'))
   342             ui.warn(_('files not configured for expansion or untracked\n'))
   340             return
   343             return
   341         commit = False
   344         commit = False