mercurial/cmdutil.py
changeset 37778 f10cb49951e1
parent 37774 d6970628b95f
child 37815 32a75a8a5b0f
equal deleted inserted replaced
37777:a4cac7b0ea4f 37778:f10cb49951e1
  2056     for r in repo.revs('filelog("path:.hgsub")'):
  2056     for r in repo.revs('filelog("path:.hgsub")'):
  2057         ctx = repo[r]
  2057         ctx = repo[r]
  2058         for subpath in ctx.substate:
  2058         for subpath in ctx.substate:
  2059             ctx.sub(subpath).addwebdirpath(serverpath, webconf)
  2059             ctx.sub(subpath).addwebdirpath(serverpath, webconf)
  2060 
  2060 
  2061 def forget(ui, repo, match, prefix, explicitonly, dryrun, confirm):
  2061 def forget(ui, repo, match, prefix, explicitonly, dryrun, interactive):
  2062     if dryrun and confirm:
  2062     if dryrun and interactive:
  2063         raise error.Abort(_("cannot specify both --dry-run and --confirm"))
  2063         raise error.Abort(_("cannot specify both --dry-run and --interactive"))
  2064     join = lambda f: os.path.join(prefix, f)
  2064     join = lambda f: os.path.join(prefix, f)
  2065     bad = []
  2065     bad = []
  2066     badfn = lambda x, y: bad.append(x) or match.bad(x, y)
  2066     badfn = lambda x, y: bad.append(x) or match.bad(x, y)
  2067     wctx = repo[None]
  2067     wctx = repo[None]
  2068     forgot = []
  2068     forgot = []
  2074 
  2074 
  2075     for subpath in sorted(wctx.substate):
  2075     for subpath in sorted(wctx.substate):
  2076         sub = wctx.sub(subpath)
  2076         sub = wctx.sub(subpath)
  2077         try:
  2077         try:
  2078             submatch = matchmod.subdirmatcher(subpath, match)
  2078             submatch = matchmod.subdirmatcher(subpath, match)
  2079             subbad, subforgot = sub.forget(submatch, prefix,
  2079             subbad, subforgot = sub.forget(submatch, prefix, dryrun=dryrun,
  2080                                            dryrun=dryrun, confirm=confirm)
  2080                                            interactive=interactive)
  2081             bad.extend([subpath + '/' + f for f in subbad])
  2081             bad.extend([subpath + '/' + f for f in subbad])
  2082             forgot.extend([subpath + '/' + f for f in subforgot])
  2082             forgot.extend([subpath + '/' + f for f in subforgot])
  2083         except error.LookupError:
  2083         except error.LookupError:
  2084             ui.status(_("skipping missing subrepository: %s\n")
  2084             ui.status(_("skipping missing subrepository: %s\n")
  2085                            % join(subpath))
  2085                            % join(subpath))
  2098                         ui.warn(_('not removing %s: '
  2098                         ui.warn(_('not removing %s: '
  2099                                   'file is already untracked\n')
  2099                                   'file is already untracked\n')
  2100                                 % match.rel(f))
  2100                                 % match.rel(f))
  2101                     bad.append(f)
  2101                     bad.append(f)
  2102 
  2102 
  2103     if confirm:
  2103     if interactive:
  2104         responses = _('[Ynsa?]'
  2104         responses = _('[Ynsa?]'
  2105                       '$$ &Yes, forget this file'
  2105                       '$$ &Yes, forget this file'
  2106                       '$$ &No, skip this file'
  2106                       '$$ &No, skip this file'
  2107                       '$$ &Skip remaining files'
  2107                       '$$ &Skip remaining files'
  2108                       '$$ Include &all remaining files'
  2108                       '$$ Include &all remaining files'
  2125                 break
  2125                 break
  2126             elif r == 3: # All
  2126             elif r == 3: # All
  2127                 break
  2127                 break
  2128 
  2128 
  2129     for f in forget:
  2129     for f in forget:
  2130         if ui.verbose or not match.exact(f) or confirm:
  2130         if ui.verbose or not match.exact(f) or interactive:
  2131             ui.status(_('removing %s\n') % match.rel(f))
  2131             ui.status(_('removing %s\n') % match.rel(f))
  2132 
  2132 
  2133     if not dryrun:
  2133     if not dryrun:
  2134         rejected = wctx.forget(forget, prefix)
  2134         rejected = wctx.forget(forget, prefix)
  2135         bad.extend(f for f in rejected if f in match.files())
  2135         bad.extend(f for f in rejected if f in match.files())