mercurial/commands.py
changeset 4966 8d982aef0be1
parent 4950 93b7e2fa7ee3
child 4967 cf67b5f3743d
child 5061 a49f2a4d5ff7
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):