mercurial/cmdutil.py
changeset 6656 2cbe0f72c379
parent 6603 41eb20cc1c02
parent 6651 7f0dd352fb4d
child 6739 c9fbd6ec3489
equal deleted inserted replaced
6655:ab798a37b846 6656:2cbe0f72c379
   274         dry_run = opts.get('dry_run')
   274         dry_run = opts.get('dry_run')
   275     if similarity is None:
   275     if similarity is None:
   276         similarity = float(opts.get('similarity') or 0)
   276         similarity = float(opts.get('similarity') or 0)
   277     add, remove = [], []
   277     add, remove = [], []
   278     mapping = {}
   278     mapping = {}
       
   279     audit_path = util.path_auditor(repo.root)
   279     m = match(repo, pats, opts)
   280     m = match(repo, pats, opts)
   280     for abs in repo.walk(m):
   281     for abs in repo.walk(m):
   281         target = repo.wjoin(abs)
   282         target = repo.wjoin(abs)
       
   283         good = True
       
   284         try:
       
   285             audit_path(abs)
       
   286         except:
       
   287             good = False
   282         rel = m.rel(abs)
   288         rel = m.rel(abs)
   283         exact = m.exact(abs)
   289         exact = m.exact(abs)
   284         if abs not in repo.dirstate:
   290         if good and abs not in repo.dirstate:
   285             add.append(abs)
   291             add.append(abs)
   286             mapping[abs] = rel, m.exact(abs)
   292             mapping[abs] = rel, m.exact(abs)
   287             if repo.ui.verbose or not exact:
   293             if repo.ui.verbose or not exact:
   288                 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs))
   294                 repo.ui.status(_('adding %s\n') % ((pats and rel) or abs))
   289         if repo.dirstate[abs] != 'r' and (not util.lexists(target)
   295         if repo.dirstate[abs] != 'r' and (not good or not util.lexists(target)
   290             or (os.path.isdir(target) and not os.path.islink(target))):
   296             or (os.path.isdir(target) and not os.path.islink(target))):
   291             remove.append(abs)
   297             remove.append(abs)
   292             mapping[abs] = rel, exact
   298             mapping[abs] = rel, exact
   293             if repo.ui.verbose or not exact:
   299             if repo.ui.verbose or not exact:
   294                 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs))
   300                 repo.ui.status(_('removing %s\n') % ((pats and rel) or abs))