diff 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
line wrap: on
line diff
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -53,7 +53,10 @@ def addremove(ui, repo, *pats, **opts):
     between 0 (disabled) and 100 (files must be identical) as its
     parameter.  Detecting renamed files this way can be expensive.
     """
-    sim = float(opts.get('similarity') or 0)
+    try:
+        sim = float(opts.get('similarity') or 0)
+    except ValueError:
+        raise util.Abort(_('similarity must be a number'))
     if sim < 0 or sim > 100:
         raise util.Abort(_('similarity must be between 0 and 100'))
     return cmdutil.addremove(repo, pats, opts, similarity=sim/100.)