hgkw/keyword.py
changeset 509 16b690351c0d
parent 507 51296bd1652f
child 517 3fef0be9f550
equal deleted inserted replaced
507:51296bd1652f 509:16b690351c0d
   348         if name.split('.', 1)[0].find('commit') > -1:
   348         if name.split('.', 1)[0].find('commit') > -1:
   349             repo.ui.setconfig('hooks', name, '')
   349             repo.ui.setconfig('hooks', name, '')
   350     ui.note(_('unhooked all commit hooks\n'))
   350     ui.note(_('unhooked all commit hooks\n'))
   351     ui.note('hg -R "%s" ci -m "%s"\n' % (tmpdir, msg))
   351     ui.note('hg -R "%s" ci -m "%s"\n' % (tmpdir, msg))
   352     repo.commit(text=msg)
   352     repo.commit(text=msg)
   353     format = ui.verbose and ' in %s' % path or ''
   353     fmt = ui.verbose and ' in %s' % path or ''
   354     demostatus('%s keywords expanded%s' % (kwstatus, format))
   354     demostatus('%s keywords expanded%s' % (kwstatus, fmt))
   355     ui.write(repo.wread(fn))
   355     ui.write(repo.wread(fn))
   356     ui.debug(_('\nremoving temporary repo %s\n') % tmpdir)
   356     ui.debug(_('\nremoving temporary repo %s\n') % tmpdir)
   357     shutil.rmtree(tmpdir, ignore_errors=True)
   357     shutil.rmtree(tmpdir, ignore_errors=True)
   358 
   358 
   359 def expand(ui, repo, *pats, **opts):
   359 def expand(ui, repo, *pats, **opts):
   382     cwd = pats and repo.getcwd() or ''
   382     cwd = pats and repo.getcwd() or ''
   383     kwfstats = not opts.get('ignore') and (('K', kwfiles),) or ()
   383     kwfstats = not opts.get('ignore') and (('K', kwfiles),) or ()
   384     if opts.get('all') or opts.get('ignore'):
   384     if opts.get('all') or opts.get('ignore'):
   385         kwfstats += (('I', [f for f in files if f not in kwfiles]),)
   385         kwfstats += (('I', [f for f in files if f not in kwfiles]),)
   386     for char, filenames in kwfstats:
   386     for char, filenames in kwfstats:
   387         format = (opts.get('all') or ui.verbose) and '%s %%s\n' % char or '%s\n'
   387         fmt = (opts.get('all') or ui.verbose) and '%s %%s\n' % char or '%s\n'
   388         for f in filenames:
   388         for f in filenames:
   389             ui.write(format % repo.pathto(f, cwd))
   389             ui.write(fmt % repo.pathto(f, cwd))
   390 
   390 
   391 def shrink(ui, repo, *pats, **opts):
   391 def shrink(ui, repo, *pats, **opts):
   392     '''revert expanded keywords in working directory
   392     '''revert expanded keywords in working directory
   393 
   393 
   394     Run before changing/disabling active keywords
   394     Run before changing/disabling active keywords