diff mercurial/commands.py @ 37306:6942c73f0733

addremove: pass command-level similarity value down to scmutil.addremove() Since we've changed to carry a similarity value by opts dict, it makes sense to leave a string '0'-'100' value unmodified.
author Yuya Nishihara <yuya@tcha.org>
date Tue, 03 Apr 2018 22:24:50 +0900
parents 14cd5290c4e6
children 4d69668a65d8
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Apr 03 13:37:57 2018 -0400
+++ b/mercurial/commands.py	Tue Apr 03 22:24:50 2018 +0900
@@ -247,13 +247,8 @@
     Returns 0 if all files are successfully added.
     """
     opts = pycompat.byteskwargs(opts)
-    try:
-        sim = float(opts.get('similarity') or 100)
-    except ValueError:
-        raise error.Abort(_('similarity must be a number'))
-    if sim < 0 or sim > 100:
-        raise error.Abort(_('similarity must be between 0 and 100'))
-    opts['similarity'] = sim / 100.0
+    if not opts.get('similarity'):
+        opts['similarity'] = '100'
     matcher = scmutil.match(repo[None], pats, opts)
     return scmutil.addremove(repo, matcher, "", opts)