mercurial/cmdutil.py
changeset 37150 335e19c6b7fa
parent 37103 be3f33f5e232
child 37270 6ff8bd691fb8
equal deleted inserted replaced
37149:cc0a6ea95d98 37150:335e19c6b7fa
  2081                 ui.status(_("skipping missing subrepository: %s\n")
  2081                 ui.status(_("skipping missing subrepository: %s\n")
  2082                                % m.abs(subpath))
  2082                                % m.abs(subpath))
  2083 
  2083 
  2084     return ret
  2084     return ret
  2085 
  2085 
  2086 def remove(ui, repo, m, prefix, after, force, subrepos, warnings=None):
  2086 def remove(ui, repo, m, prefix, after, force, subrepos, dryrun, warnings=None):
  2087     join = lambda f: os.path.join(prefix, f)
  2087     join = lambda f: os.path.join(prefix, f)
  2088     ret = 0
  2088     ret = 0
  2089     s = repo.status(match=m, clean=True)
  2089     s = repo.status(match=m, clean=True)
  2090     modified, added, deleted, clean = s[0], s[1], s[3], s[6]
  2090     modified, added, deleted, clean = s[0], s[1], s[3], s[6]
  2091 
  2091 
  2106         if subrepos or m.exact(subpath) or any(submatch.files()):
  2106         if subrepos or m.exact(subpath) or any(submatch.files()):
  2107             ui.progress(_('searching'), count, total=total, unit=_('subrepos'))
  2107             ui.progress(_('searching'), count, total=total, unit=_('subrepos'))
  2108             sub = wctx.sub(subpath)
  2108             sub = wctx.sub(subpath)
  2109             try:
  2109             try:
  2110                 if sub.removefiles(submatch, prefix, after, force, subrepos,
  2110                 if sub.removefiles(submatch, prefix, after, force, subrepos,
  2111                                    warnings):
  2111                                    dryrun, warnings):
  2112                     ret = 1
  2112                     ret = 1
  2113             except error.LookupError:
  2113             except error.LookupError:
  2114                 warnings.append(_("skipping missing subrepository: %s\n")
  2114                 warnings.append(_("skipping missing subrepository: %s\n")
  2115                                % join(subpath))
  2115                                % join(subpath))
  2116     ui.progress(_('searching'), None)
  2116     ui.progress(_('searching'), None)
  2186         if ui.verbose or not m.exact(f):
  2186         if ui.verbose or not m.exact(f):
  2187             ui.progress(_('deleting'), count, total=total, unit=_('files'))
  2187             ui.progress(_('deleting'), count, total=total, unit=_('files'))
  2188             ui.status(_('removing %s\n') % m.rel(f))
  2188             ui.status(_('removing %s\n') % m.rel(f))
  2189     ui.progress(_('deleting'), None)
  2189     ui.progress(_('deleting'), None)
  2190 
  2190 
  2191     with repo.wlock():
  2191     if not dryrun:
  2192         if not after:
  2192         with repo.wlock():
  2193             for f in list:
  2193             if not after:
  2194                 if f in added:
  2194                 for f in list:
  2195                     continue # we never unlink added files on remove
  2195                     if f in added:
  2196                 repo.wvfs.unlinkpath(f, ignoremissing=True)
  2196                         continue # we never unlink added files on remove
  2197         repo[None].forget(list)
  2197                     repo.wvfs.unlinkpath(f, ignoremissing=True)
       
  2198             repo[None].forget(list)
  2198 
  2199 
  2199     if warn:
  2200     if warn:
  2200         for warning in warnings:
  2201         for warning in warnings:
  2201             ui.warn(warning)
  2202             ui.warn(warning)
  2202 
  2203