Show More
@@ -53,7 +53,10 b' def addremove(ui, repo, *pats, **opts):' | |||||
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.) |
@@ -41,3 +41,9 b' hg addremove -s50' | |||||
41 |
|
41 | |||
42 | hg commit -m B |
|
42 | hg commit -m B | |
43 |
|
43 | |||
|
44 | echo % should all fail | |||
|
45 | hg addremove -s foo | |||
|
46 | hg addremove -s -1 | |||
|
47 | hg addremove -s 1e6 | |||
|
48 | ||||
|
49 | true |
@@ -14,3 +14,7 b' adding small-file' | |||||
14 | removing large-file |
|
14 | removing large-file | |
15 | removing tiny-file |
|
15 | removing tiny-file | |
16 | recording removal of tiny-file as rename to small-file (82% similar) |
|
16 | recording removal of tiny-file as rename to small-file (82% similar) | |
|
17 | % should all fail | |||
|
18 | abort: similarity must be a number | |||
|
19 | abort: similarity must be between 0 and 100 | |||
|
20 | abort: similarity must be between 0 and 100 |
General Comments 0
You need to be logged in to leave comments.
Login now