mercurial/cmdutil.py
changeset 23686 164915e8ef7b
parent 23674 6e36b9fc7869
child 23691 e41bcb019633
equal deleted inserted replaced
23685:5b1eac343ccd 23686:164915e8ef7b
  1989         if exact or not explicitonly and f not in wctx and repo.wvfs.lexists(f):
  1989         if exact or not explicitonly and f not in wctx and repo.wvfs.lexists(f):
  1990             if cca:
  1990             if cca:
  1991                 cca(f)
  1991                 cca(f)
  1992             names.append(f)
  1992             names.append(f)
  1993             if ui.verbose or not exact:
  1993             if ui.verbose or not exact:
  1994                 ui.status(_('adding %s\n') % match.rel(join(f)))
  1994                 ui.status(_('adding %s\n') % match.rel(f))
  1995 
  1995 
  1996     for subpath in sorted(wctx.substate):
  1996     for subpath in sorted(wctx.substate):
  1997         sub = wctx.sub(subpath)
  1997         sub = wctx.sub(subpath)
  1998         try:
  1998         try:
  1999             submatch = matchmod.narrowmatcher(subpath, match)
  1999             submatch = matchmod.narrowmatcher(subpath, match)
  2040             if f not in repo.dirstate and not repo.wvfs.isdir(f):
  2040             if f not in repo.dirstate and not repo.wvfs.isdir(f):
  2041                 if f not in forgot:
  2041                 if f not in forgot:
  2042                     if repo.wvfs.exists(f):
  2042                     if repo.wvfs.exists(f):
  2043                         ui.warn(_('not removing %s: '
  2043                         ui.warn(_('not removing %s: '
  2044                                   'file is already untracked\n')
  2044                                   'file is already untracked\n')
  2045                                 % match.rel(join(f)))
  2045                                 % match.rel(f))
  2046                     bad.append(f)
  2046                     bad.append(f)
  2047 
  2047 
  2048     for f in forget:
  2048     for f in forget:
  2049         if ui.verbose or not match.exact(f):
  2049         if ui.verbose or not match.exact(f):
  2050             ui.status(_('removing %s\n') % match.rel(join(f)))
  2050             ui.status(_('removing %s\n') % match.rel(f))
  2051 
  2051 
  2052     rejected = wctx.forget(forget, prefix)
  2052     rejected = wctx.forget(forget, prefix)
  2053     bad.extend(f for f in rejected if f in match.files())
  2053     bad.extend(f for f in rejected if f in match.files())
  2054     forgot.extend(forget)
  2054     forgot.extend(forget)
  2055     return bad, forgot
  2055     return bad, forgot
  2093             continue
  2093             continue
  2094 
  2094 
  2095         if repo.wvfs.exists(f):
  2095         if repo.wvfs.exists(f):
  2096             if repo.wvfs.isdir(f):
  2096             if repo.wvfs.isdir(f):
  2097                 ui.warn(_('not removing %s: no tracked files\n')
  2097                 ui.warn(_('not removing %s: no tracked files\n')
  2098                         % m.rel(join(f)))
  2098                         % m.rel(f))
  2099             else:
  2099             else:
  2100                 ui.warn(_('not removing %s: file is untracked\n')
  2100                 ui.warn(_('not removing %s: file is untracked\n')
  2101                         % m.rel(join(f)))
  2101                         % m.rel(f))
  2102         # missing files will generate a warning elsewhere
  2102         # missing files will generate a warning elsewhere
  2103         ret = 1
  2103         ret = 1
  2104 
  2104 
  2105     if force:
  2105     if force:
  2106         list = modified + deleted + clean + added
  2106         list = modified + deleted + clean + added
  2107     elif after:
  2107     elif after:
  2108         list = deleted
  2108         list = deleted
  2109         for f in modified + added + clean:
  2109         for f in modified + added + clean:
  2110             ui.warn(_('not removing %s: file still exists\n') % m.rel(join(f)))
  2110             ui.warn(_('not removing %s: file still exists\n') % m.rel(f))
  2111             ret = 1
  2111             ret = 1
  2112     else:
  2112     else:
  2113         list = deleted + clean
  2113         list = deleted + clean
  2114         for f in modified:
  2114         for f in modified:
  2115             ui.warn(_('not removing %s: file is modified (use -f'
  2115             ui.warn(_('not removing %s: file is modified (use -f'
  2116                       ' to force removal)\n') % m.rel(join(f)))
  2116                       ' to force removal)\n') % m.rel(f))
  2117             ret = 1
  2117             ret = 1
  2118         for f in added:
  2118         for f in added:
  2119             ui.warn(_('not removing %s: file has been marked for add'
  2119             ui.warn(_('not removing %s: file has been marked for add'
  2120                       ' (use forget to undo)\n') % m.rel(join(f)))
  2120                       ' (use forget to undo)\n') % m.rel(f))
  2121             ret = 1
  2121             ret = 1
  2122 
  2122 
  2123     for f in sorted(list):
  2123     for f in sorted(list):
  2124         if ui.verbose or not m.exact(f):
  2124         if ui.verbose or not m.exact(f):
  2125             ui.status(_('removing %s\n') % m.rel(join(f)))
  2125             ui.status(_('removing %s\n') % m.rel(f))
  2126 
  2126 
  2127     wlock = repo.wlock()
  2127     wlock = repo.wlock()
  2128     try:
  2128     try:
  2129         if not after:
  2129         if not after:
  2130             for f in list:
  2130             for f in list: