hgkw/keyword.py
branchstable
changeset 529 7197324dfa4d
parent 527 59cb740ebf83
child 531 f7865fb770fe
equal deleted inserted replaced
527:59cb740ebf83 529:7197324dfa4d
    52     # expand keywords in every python file except those matching "x*"
    52     # expand keywords in every python file except those matching "x*"
    53     **.py =
    53     **.py =
    54     x*    = ignore
    54     x*    = ignore
    55 
    55 
    56 Note: the more specific you are in your filename patterns
    56 Note: the more specific you are in your filename patterns
    57       the less you lose speed in huge repos.
    57       the less you lose speed in huge repositories.
    58 
    58 
    59 For [keywordmaps] template mapping and expansion demonstration and
    59 For [keywordmaps] template mapping and expansion demonstration and
    60 control run "hg kwdemo".
    60 control run "hg kwdemo".
    61 
    61 
    62 An additional date template filter {date|utcdate} is provided.
    62 An additional date template filter {date|utcdate} is provided.
   299     msg = 'hg keyword config and expansion example'
   299     msg = 'hg keyword config and expansion example'
   300     kwstatus = 'current'
   300     kwstatus = 'current'
   301     fn = 'demo.txt'
   301     fn = 'demo.txt'
   302     branchname = 'demobranch'
   302     branchname = 'demobranch'
   303     tmpdir = tempfile.mkdtemp('', 'kwdemo.')
   303     tmpdir = tempfile.mkdtemp('', 'kwdemo.')
   304     ui.note(_('creating temporary repo at %s\n') % tmpdir)
   304     ui.note(_('creating temporary repository at %s\n') % tmpdir)
   305     repo = localrepo.localrepository(ui, tmpdir, True)
   305     repo = localrepo.localrepository(ui, tmpdir, True)
   306     ui.setconfig('keyword', fn, '')
   306     ui.setconfig('keyword', fn, '')
   307     if args or opts.get('rcfile'):
   307     if args or opts.get('rcfile'):
   308         kwstatus = 'custom'
   308         kwstatus = 'custom'
   309     if opts.get('rcfile'):
   309     if opts.get('rcfile'):
   353     ui.note('hg -R "%s" ci -m "%s"\n' % (tmpdir, msg))
   353     ui.note('hg -R "%s" ci -m "%s"\n' % (tmpdir, msg))
   354     repo.commit(text=msg)
   354     repo.commit(text=msg)
   355     fmt = ui.verbose and ' in %s' % path or ''
   355     fmt = ui.verbose and ' in %s' % path or ''
   356     demostatus('%s keywords expanded%s' % (kwstatus, fmt))
   356     demostatus('%s keywords expanded%s' % (kwstatus, fmt))
   357     ui.write(repo.wread(fn))
   357     ui.write(repo.wread(fn))
   358     ui.debug(_('\nremoving temporary repo %s\n') % tmpdir)
   358     ui.debug(_('\nremoving temporary repository %s\n') % tmpdir)
   359     shutil.rmtree(tmpdir, ignore_errors=True)
   359     shutil.rmtree(tmpdir, ignore_errors=True)
   360 
   360 
   361 def expand(ui, repo, *pats, **opts):
   361 def expand(ui, repo, *pats, **opts):
   362     '''expand keywords in working directory
   362     '''expand keywords in working directory
   363 
   363