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