comparison mercurial/commands.py @ 2958:ff3ea21a981a

addremove: add -s/--similarity option progress on issue 295.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Fri, 18 Aug 2006 22:13:58 -0700
parents 6dddcba7596a
children a8546e40070a
comparison
equal deleted inserted replaced
2957:6e062d9b188f 2958:ff3ea21a981a
656 656
657 Add all new files and remove all missing files from the repository. 657 Add all new files and remove all missing files from the repository.
658 658
659 New files are ignored if they match any of the patterns in .hgignore. As 659 New files are ignored if they match any of the patterns in .hgignore. As
660 with add, these changes take effect at the next commit. 660 with add, these changes take effect at the next commit.
661 """ 661
662 return cmdutil.addremove(repo, pats, opts) 662 Use the -s option to detect renamed files. With a parameter > 0,
663 this compares every removed file with every added file and records
664 those similar enough as renames. This option takes a percentage
665 between 0 (disabled) and 100 (files must be identical) as its
666 parameter. Detecting renamed files this way can be expensive.
667 """
668 sim = float(opts.get('similarity') or 0)
669 if sim < 0 or sim > 100:
670 raise util.Abort(_('similarity must be between 0 and 100'))
671 return cmdutil.addremove(repo, pats, opts, similarity=sim/100.)
663 672
664 def annotate(ui, repo, *pats, **opts): 673 def annotate(ui, repo, *pats, **opts):
665 """show changeset information per file line 674 """show changeset information per file line
666 675
667 List changes in files, showing the revision id responsible for each line 676 List changes in files, showing the revision id responsible for each line
2745 _('hg add [OPTION]... [FILE]...')), 2754 _('hg add [OPTION]... [FILE]...')),
2746 "addremove": 2755 "addremove":
2747 (addremove, 2756 (addremove,
2748 [('I', 'include', [], _('include names matching the given patterns')), 2757 [('I', 'include', [], _('include names matching the given patterns')),
2749 ('X', 'exclude', [], _('exclude names matching the given patterns')), 2758 ('X', 'exclude', [], _('exclude names matching the given patterns')),
2750 ('n', 'dry-run', None, _('do not perform actions, just print output'))], 2759 ('n', 'dry-run', None,
2760 _('do not perform actions, just print output')),
2761 ('s', 'similarity', '',
2762 _('guess renamed files by similarity (0<=s<=1)'))],
2751 _('hg addremove [OPTION]... [FILE]...')), 2763 _('hg addremove [OPTION]... [FILE]...')),
2752 "^annotate": 2764 "^annotate":
2753 (annotate, 2765 (annotate,
2754 [('r', 'rev', '', _('annotate the specified revision')), 2766 [('r', 'rev', '', _('annotate the specified revision')),
2755 ('a', 'text', None, _('treat all files as text')), 2767 ('a', 'text', None, _('treat all files as text')),