Mercurial > hg
comparison mercurial/commands.py @ 4966:8d982aef0be1
addremove: print meaningful error message if --similar not numeric
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Sat, 21 Jul 2007 19:07:18 -0700 |
parents | 93b7e2fa7ee3 |
children | cf67b5f3743d a49f2a4d5ff7 |
comparison
equal
deleted
inserted
replaced
4962:10afa3fab6b4 | 4966:8d982aef0be1 |
---|---|
51 this compares every removed file with every added file and records | 51 this compares every removed file with every added file and records |
52 those similar enough as renames. This option takes a percentage | 52 those similar enough as renames. This option takes a percentage |
53 between 0 (disabled) and 100 (files must be identical) as its | 53 between 0 (disabled) and 100 (files must be identical) as its |
54 parameter. Detecting renamed files this way can be expensive. | 54 parameter. Detecting renamed files this way can be expensive. |
55 """ | 55 """ |
56 sim = float(opts.get('similarity') or 0) | 56 try: |
57 sim = float(opts.get('similarity') or 0) | |
58 except ValueError: | |
59 raise util.Abort(_('similarity must be a number')) | |
57 if sim < 0 or sim > 100: | 60 if sim < 0 or sim > 100: |
58 raise util.Abort(_('similarity must be between 0 and 100')) | 61 raise util.Abort(_('similarity must be between 0 and 100')) |
59 return cmdutil.addremove(repo, pats, opts, similarity=sim/100.) | 62 return cmdutil.addremove(repo, pats, opts, similarity=sim/100.) |
60 | 63 |
61 def annotate(ui, repo, *pats, **opts): | 64 def annotate(ui, repo, *pats, **opts): |