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