##// 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 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
@@ -754,7 +754,13 b' def addremove(repo, matcher, prefix, opt'
754 opts = {}
754 opts = {}
755 m = matcher
755 m = matcher
756 dry_run = opts.get('dry_run')
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 ret = 0
765 ret = 0
760 join = lambda f: os.path.join(prefix, f)
766 join = lambda f: os.path.join(prefix, f)
General Comments 0
You need to be logged in to leave comments. Login now