mercurial/cmdutil.py
changeset 25436 9724cbe2d546
parent 25424 69609f43c752
child 25437 9c1bcd95b3ff
equal deleted inserted replaced
25435:a592a6a6f4fe 25436:9724cbe2d546
  2211     return graphmod.nodes(repo, nodes)
  2211     return graphmod.nodes(repo, nodes)
  2212 
  2212 
  2213 def add(ui, repo, match, prefix, explicitonly, **opts):
  2213 def add(ui, repo, match, prefix, explicitonly, **opts):
  2214     join = lambda f: os.path.join(prefix, f)
  2214     join = lambda f: os.path.join(prefix, f)
  2215     bad = []
  2215     bad = []
  2216     oldbad = match.bad
  2216 
  2217     match.bad = lambda x, y: bad.append(x) or oldbad(x, y)
  2217     badfn = lambda x, y: bad.append(x) or match.bad(x, y)
  2218     names = []
  2218     names = []
  2219     wctx = repo[None]
  2219     wctx = repo[None]
  2220     cca = None
  2220     cca = None
  2221     abort, warn = scmutil.checkportabilityalert(ui)
  2221     abort, warn = scmutil.checkportabilityalert(ui)
  2222     if abort or warn:
  2222     if abort or warn:
  2223         cca = scmutil.casecollisionauditor(ui, abort, repo.dirstate)
  2223         cca = scmutil.casecollisionauditor(ui, abort, repo.dirstate)
  2224     for f in wctx.walk(match):
  2224 
       
  2225     for f in wctx.walk(matchmod.badmatch(match, badfn)):
  2225         exact = match.exact(f)
  2226         exact = match.exact(f)
  2226         if exact or not explicitonly and f not in wctx and repo.wvfs.lexists(f):
  2227         if exact or not explicitonly and f not in wctx and repo.wvfs.lexists(f):
  2227             if cca:
  2228             if cca:
  2228                 cca(f)
  2229                 cca(f)
  2229             names.append(f)
  2230             names.append(f)