mercurial/commands.py
changeset 37306 6942c73f0733
parent 37269 14cd5290c4e6
child 37307 4d69668a65d8
equal deleted inserted replaced
37305:611e466662af 37306:6942c73f0733
   245              R foobar.c
   245              R foobar.c
   246 
   246 
   247     Returns 0 if all files are successfully added.
   247     Returns 0 if all files are successfully added.
   248     """
   248     """
   249     opts = pycompat.byteskwargs(opts)
   249     opts = pycompat.byteskwargs(opts)
   250     try:
   250     if not opts.get('similarity'):
   251         sim = float(opts.get('similarity') or 100)
   251         opts['similarity'] = '100'
   252     except ValueError:
       
   253         raise error.Abort(_('similarity must be a number'))
       
   254     if sim < 0 or sim > 100:
       
   255         raise error.Abort(_('similarity must be between 0 and 100'))
       
   256     opts['similarity'] = sim / 100.0
       
   257     matcher = scmutil.match(repo[None], pats, opts)
   252     matcher = scmutil.match(repo[None], pats, opts)
   258     return scmutil.addremove(repo, matcher, "", opts)
   253     return scmutil.addremove(repo, matcher, "", opts)
   259 
   254 
   260 @command('^annotate|blame',
   255 @command('^annotate|blame',
   261     [('r', 'rev', '', _('annotate the specified revision'), _('REV')),
   256     [('r', 'rev', '', _('annotate the specified revision'), _('REV')),