##// END OF EJS Templates
addremove: pass command-level similarity value down to scmutil.addremove()...
Yuya Nishihara -
r37322:6942c73f default
parent child Browse files
Show More
@@ -247,13 +247,8 b' def addremove(ui, repo, *pats, **opts):'
247 247 Returns 0 if all files are successfully added.
248 248 """
249 249 opts = pycompat.byteskwargs(opts)
250 try:
251 sim = float(opts.get('similarity') or 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
250 if not opts.get('similarity'):
251 opts['similarity'] = '100'
257 252 matcher = scmutil.match(repo[None], pats, opts)
258 253 return scmutil.addremove(repo, matcher, "", opts)
259 254
@@ -754,7 +754,13 b' def addremove(repo, matcher, prefix, opt'
754 754 opts = {}
755 755 m = matcher
756 756 dry_run = opts.get('dry_run')
757 similarity = float(opts.get('similarity') or 0)
757 try:
758 similarity = float(opts.get('similarity') or 0)
759 except ValueError:
760 raise error.Abort(_('similarity must be a number'))
761 if similarity < 0 or similarity > 100:
762 raise error.Abort(_('similarity must be between 0 and 100'))
763 similarity /= 100.0
758 764
759 765 ret = 0
760 766 join = lambda f: os.path.join(prefix, f)
General Comments 0
You need to be logged in to leave comments. Login now