##// END OF EJS Templates
addremove: remove dry_run, similarity from scmutil.addremove (API)...
Sushil khanchi -
r37286:14cd5290 default
parent child Browse files
Show More
@@ -423,7 +423,8 b' def perfaddremove(ui, repo, **opts):'
423 423 oldquiet = repo.ui.quiet
424 424 repo.ui.quiet = True
425 425 matcher = scmutil.match(repo[None])
426 timer(lambda: scmutil.addremove(repo, matcher, "", dry_run=True))
426 opts['dry_run'] = True
427 timer(lambda: scmutil.addremove(repo, matcher, "", opts))
427 428 finally:
428 429 repo.ui.quiet = oldquiet
429 430 fm.end()
@@ -1214,12 +1214,11 b' def overridesummary(orig, ui, repo, *pat'
1214 1214 finally:
1215 1215 repo.lfstatus = False
1216 1216
1217 def scmutiladdremove(orig, repo, matcher, prefix, opts=None, dry_run=None,
1218 similarity=None):
1217 def scmutiladdremove(orig, repo, matcher, prefix, opts=None):
1219 1218 if opts is None:
1220 1219 opts = {}
1221 1220 if not lfutil.islfilesrepo(repo):
1222 return orig(repo, matcher, prefix, opts, dry_run, similarity)
1221 return orig(repo, matcher, prefix, opts)
1223 1222 # Get the list of missing largefiles so we can remove them
1224 1223 lfdirstate = lfutil.openlfdirstate(repo.ui, repo)
1225 1224 unsure, s = lfdirstate.status(matchmod.always(repo.root, repo.getcwd()),
@@ -1250,7 +1249,7 b' def scmutiladdremove(orig, repo, matcher'
1250 1249 # function to take care of the rest. Make sure it doesn't do anything with
1251 1250 # largefiles by passing a matcher that will ignore them.
1252 1251 matcher = composenormalfilematcher(matcher, repo[None].manifest(), added)
1253 return orig(repo, matcher, prefix, opts, dry_run, similarity)
1252 return orig(repo, matcher, prefix, opts)
1254 1253
1255 1254 # Calling purge with --all will cause the largefiles to be deleted.
1256 1255 # Override repo.status to prevent this from happening.
@@ -253,8 +253,9 b' def addremove(ui, repo, *pats, **opts):'
253 253 raise error.Abort(_('similarity must be a number'))
254 254 if sim < 0 or sim > 100:
255 255 raise error.Abort(_('similarity must be between 0 and 100'))
256 opts['similarity'] = sim / 100.0
256 257 matcher = scmutil.match(repo[None], pats, opts)
257 return scmutil.addremove(repo, matcher, "", opts, similarity=sim / 100.0)
258 return scmutil.addremove(repo, matcher, "", opts)
258 259
259 260 @command('^annotate|blame',
260 261 [('r', 'rev', '', _('annotate the specified revision'), _('REV')),
@@ -736,14 +736,12 b' def cleanupnodes(repo, replacements, ope'
736 736 if tostrip:
737 737 repair.delayedstrip(repo.ui, repo, tostrip, operation)
738 738
739 def addremove(repo, matcher, prefix, opts=None, dry_run=None, similarity=None):
739 def addremove(repo, matcher, prefix, opts=None):
740 740 if opts is None:
741 741 opts = {}
742 742 m = matcher
743 if dry_run is None:
744 dry_run = opts.get('dry_run')
745 if similarity is None:
746 similarity = float(opts.get('similarity') or 0)
743 dry_run = opts.get('dry_run')
744 similarity = float(opts.get('similarity') or 0)
747 745
748 746 ret = 0
749 747 join = lambda f: os.path.join(prefix, f)
@@ -754,7 +752,7 b' def addremove(repo, matcher, prefix, opt'
754 752 if opts.get('subrepos') or m.exact(subpath) or any(submatch.files()):
755 753 sub = wctx.sub(subpath)
756 754 try:
757 if sub.addremove(submatch, prefix, opts, dry_run, similarity):
755 if sub.addremove(submatch, prefix, opts):
758 756 ret = 1
759 757 except error.LookupError:
760 758 repo.ui.status(_("skipping missing subrepository: %s\n")
@@ -287,7 +287,7 b' class abstractsubrepo(object):'
287 287 def add(self, ui, match, prefix, explicitonly, **opts):
288 288 return []
289 289
290 def addremove(self, matcher, prefix, opts, dry_run, similarity):
290 def addremove(self, matcher, prefix, opts):
291 291 self.ui.warn("%s: %s" % (prefix, _("addremove is not supported")))
292 292 return 1
293 293
@@ -510,15 +510,14 b' class hgsubrepo(abstractsubrepo):'
510 510 explicitonly, **opts)
511 511
512 512 @annotatesubrepoerror
513 def addremove(self, m, prefix, opts, dry_run, similarity):
513 def addremove(self, m, prefix, opts):
514 514 # In the same way as sub directories are processed, once in a subrepo,
515 515 # always entry any of its subrepos. Don't corrupt the options that will
516 516 # be used to process sibling subrepos however.
517 517 opts = copy.copy(opts)
518 518 opts['subrepos'] = True
519 519 return scmutil.addremove(self._repo, m,
520 self.wvfs.reljoin(prefix, self._path), opts,
521 dry_run, similarity)
520 self.wvfs.reljoin(prefix, self._path), opts)
522 521
523 522 @annotatesubrepoerror
524 523 def cat(self, match, fm, fntemplate, prefix, **opts):
General Comments 0
You need to be logged in to leave comments. Login now