mercurial/scmutil.py
changeset 37269 14cd5290c4e6
parent 37259 d29f6fbd1181
child 37271 0194dac77c93
equal deleted inserted replaced
37268:a53b87e20132 37269:14cd5290c4e6
   734             from . import repair # avoid import cycle
   734             from . import repair # avoid import cycle
   735             tostrip = list(replacements)
   735             tostrip = list(replacements)
   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)
   750 
   748 
   751     wctx = repo[None]
   749     wctx = repo[None]
   752     for subpath in sorted(wctx.substate):
   750     for subpath in sorted(wctx.substate):
   753         submatch = matchmod.subdirmatcher(subpath, m)
   751         submatch = matchmod.subdirmatcher(subpath, m)
   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")
   761                                  % join(subpath))
   759                                  % join(subpath))
   762 
   760