Mercurial > hg
changeset 37269:14cd5290c4e6
addremove: remove dry_run, similarity from scmutil.addremove (API)
Differential Revision: https://phab.mercurial-scm.org/D3000
author | Sushil khanchi <sushilkhanchi97@gmail.com> |
---|---|
date | Sat, 31 Mar 2018 23:49:58 +0530 |
parents | a53b87e20132 |
children | 6ff8bd691fb8 |
files | contrib/perf.py hgext/largefiles/overrides.py mercurial/commands.py mercurial/scmutil.py mercurial/subrepo.py |
diffstat | 5 files changed, 14 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/perf.py Tue Apr 03 12:16:19 2018 +0530 +++ b/contrib/perf.py Sat Mar 31 23:49:58 2018 +0530 @@ -423,7 +423,8 @@ oldquiet = repo.ui.quiet repo.ui.quiet = True matcher = scmutil.match(repo[None]) - timer(lambda: scmutil.addremove(repo, matcher, "", dry_run=True)) + opts['dry_run'] = True + timer(lambda: scmutil.addremove(repo, matcher, "", opts)) finally: repo.ui.quiet = oldquiet fm.end()
--- a/hgext/largefiles/overrides.py Tue Apr 03 12:16:19 2018 +0530 +++ b/hgext/largefiles/overrides.py Sat Mar 31 23:49:58 2018 +0530 @@ -1214,12 +1214,11 @@ finally: repo.lfstatus = False -def scmutiladdremove(orig, repo, matcher, prefix, opts=None, dry_run=None, - similarity=None): +def scmutiladdremove(orig, repo, matcher, prefix, opts=None): if opts is None: opts = {} if not lfutil.islfilesrepo(repo): - return orig(repo, matcher, prefix, opts, dry_run, similarity) + return orig(repo, matcher, prefix, opts) # Get the list of missing largefiles so we can remove them lfdirstate = lfutil.openlfdirstate(repo.ui, repo) unsure, s = lfdirstate.status(matchmod.always(repo.root, repo.getcwd()), @@ -1250,7 +1249,7 @@ # function to take care of the rest. Make sure it doesn't do anything with # largefiles by passing a matcher that will ignore them. matcher = composenormalfilematcher(matcher, repo[None].manifest(), added) - return orig(repo, matcher, prefix, opts, dry_run, similarity) + return orig(repo, matcher, prefix, opts) # Calling purge with --all will cause the largefiles to be deleted. # Override repo.status to prevent this from happening.
--- a/mercurial/commands.py Tue Apr 03 12:16:19 2018 +0530 +++ b/mercurial/commands.py Sat Mar 31 23:49:58 2018 +0530 @@ -253,8 +253,9 @@ raise error.Abort(_('similarity must be a number')) if sim < 0 or sim > 100: raise error.Abort(_('similarity must be between 0 and 100')) + opts['similarity'] = sim / 100.0 matcher = scmutil.match(repo[None], pats, opts) - return scmutil.addremove(repo, matcher, "", opts, similarity=sim / 100.0) + return scmutil.addremove(repo, matcher, "", opts) @command('^annotate|blame', [('r', 'rev', '', _('annotate the specified revision'), _('REV')),
--- a/mercurial/scmutil.py Tue Apr 03 12:16:19 2018 +0530 +++ b/mercurial/scmutil.py Sat Mar 31 23:49:58 2018 +0530 @@ -736,14 +736,12 @@ if tostrip: repair.delayedstrip(repo.ui, repo, tostrip, operation) -def addremove(repo, matcher, prefix, opts=None, dry_run=None, similarity=None): +def addremove(repo, matcher, prefix, opts=None): if opts is None: opts = {} m = matcher - if dry_run is None: - dry_run = opts.get('dry_run') - if similarity is None: - similarity = float(opts.get('similarity') or 0) + dry_run = opts.get('dry_run') + similarity = float(opts.get('similarity') or 0) ret = 0 join = lambda f: os.path.join(prefix, f) @@ -754,7 +752,7 @@ if opts.get('subrepos') or m.exact(subpath) or any(submatch.files()): sub = wctx.sub(subpath) try: - if sub.addremove(submatch, prefix, opts, dry_run, similarity): + if sub.addremove(submatch, prefix, opts): ret = 1 except error.LookupError: repo.ui.status(_("skipping missing subrepository: %s\n")
--- a/mercurial/subrepo.py Tue Apr 03 12:16:19 2018 +0530 +++ b/mercurial/subrepo.py Sat Mar 31 23:49:58 2018 +0530 @@ -287,7 +287,7 @@ def add(self, ui, match, prefix, explicitonly, **opts): return [] - def addremove(self, matcher, prefix, opts, dry_run, similarity): + def addremove(self, matcher, prefix, opts): self.ui.warn("%s: %s" % (prefix, _("addremove is not supported"))) return 1 @@ -510,15 +510,14 @@ explicitonly, **opts) @annotatesubrepoerror - def addremove(self, m, prefix, opts, dry_run, similarity): + def addremove(self, m, prefix, opts): # In the same way as sub directories are processed, once in a subrepo, # always entry any of its subrepos. Don't corrupt the options that will # be used to process sibling subrepos however. opts = copy.copy(opts) opts['subrepos'] = True return scmutil.addremove(self._repo, m, - self.wvfs.reljoin(prefix, self._path), opts, - dry_run, similarity) + self.wvfs.reljoin(prefix, self._path), opts) @annotatesubrepoerror def cat(self, match, fm, fntemplate, prefix, **opts):