diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -1079,10 +1079,11 @@ def postcommitstatus(orig, repo, *args, finally: repo.lfstatus = False -def cmdutilforget(orig, ui, repo, match, prefix, explicitonly, dryrun, confirm): +def cmdutilforget(orig, ui, repo, match, prefix, explicitonly, dryrun, + interactive): normalmatcher = composenormalfilematcher(match, repo[None].manifest()) bad, forgot = orig(ui, repo, normalmatcher, prefix, explicitonly, dryrun, - confirm) + interactive) m = composelargefilematcher(match, repo[None].manifest()) try: diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -2058,9 +2058,9 @@ def addwebdirpath(repo, serverpath, webc for subpath in ctx.substate: ctx.sub(subpath).addwebdirpath(serverpath, webconf) -def forget(ui, repo, match, prefix, explicitonly, dryrun, confirm): - if dryrun and confirm: - raise error.Abort(_("cannot specify both --dry-run and --confirm")) +def forget(ui, repo, match, prefix, explicitonly, dryrun, interactive): + if dryrun and interactive: + raise error.Abort(_("cannot specify both --dry-run and --interactive")) join = lambda f: os.path.join(prefix, f) bad = [] badfn = lambda x, y: bad.append(x) or match.bad(x, y) @@ -2076,8 +2076,8 @@ def forget(ui, repo, match, prefix, expl sub = wctx.sub(subpath) try: submatch = matchmod.subdirmatcher(subpath, match) - subbad, subforgot = sub.forget(submatch, prefix, - dryrun=dryrun, confirm=confirm) + subbad, subforgot = sub.forget(submatch, prefix, dryrun=dryrun, + interactive=interactive) bad.extend([subpath + '/' + f for f in subbad]) forgot.extend([subpath + '/' + f for f in subforgot]) except error.LookupError: @@ -2100,7 +2100,7 @@ def forget(ui, repo, match, prefix, expl % match.rel(f)) bad.append(f) - if confirm: + if interactive: responses = _('[Ynsa?]' '$$ &Yes, forget this file' '$$ &No, skip this file' @@ -2127,7 +2127,7 @@ def forget(ui, repo, match, prefix, expl break for f in forget: - if ui.verbose or not match.exact(f) or confirm: + if ui.verbose or not match.exact(f) or interactive: ui.status(_('removing %s\n') % match.rel(f)) if not dryrun: diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -112,7 +112,6 @@ globalopts = [ ] dryrunopts = cmdutil.dryrunopts -confirmopts = cmdutil.confirmopts remoteopts = cmdutil.remoteopts walkopts = cmdutil.walkopts commitopts = cmdutil.commitopts @@ -2062,7 +2061,8 @@ def files(ui, repo, *pats, **opts): @command( '^forget', - walkopts + dryrunopts + confirmopts, + [('i', 'interactive', None, _('use interactive mode')), + ] + walkopts + dryrunopts, _('[OPTION]... FILE...'), inferrepo=True) def forget(ui, repo, *pats, **opts): """forget the specified files on the next commit @@ -2098,10 +2098,10 @@ def forget(ui, repo, *pats, **opts): raise error.Abort(_('no files specified')) m = scmutil.match(repo[None], pats, opts) - dryrun, confirm = opts.get('dry_run'), opts.get('confirm') + dryrun, interactive = opts.get('dry_run'), opts.get('interactive') rejected = cmdutil.forget(ui, repo, m, prefix="", explicitonly=False, dryrun=dryrun, - confirm=confirm)[0] + interactive=interactive)[0] return rejected and 1 or 0 @command( diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -352,7 +352,7 @@ class abstractsubrepo(object): matched by the match function ''' - def forget(self, match, prefix, dryrun, confirm): + def forget(self, match, prefix, dryrun, interactive): return ([], []) def removefiles(self, matcher, prefix, after, force, subrepos, @@ -816,10 +816,10 @@ class hgsubrepo(abstractsubrepo): return ctx.walk(match) @annotatesubrepoerror - def forget(self, match, prefix, dryrun, confirm): + def forget(self, match, prefix, dryrun, interactive): return cmdutil.forget(self.ui, self._repo, match, self.wvfs.reljoin(prefix, self._path), - True, dryrun=dryrun, confirm=confirm) + True, dryrun=dryrun, interactive=interactive) @annotatesubrepoerror def removefiles(self, matcher, prefix, after, force, subrepos, diff --git a/tests/test-add.t b/tests/test-add.t --- a/tests/test-add.t +++ b/tests/test-add.t @@ -273,19 +273,19 @@ test --dry-run mode in forget $ cd .. -test --confirm option in forget +test --interactive mode in forget - $ hg init forgetconfirm - $ cd forgetconfirm + $ hg init interactiveforget + $ cd interactiveforget $ echo foo > foo $ hg commit -qAm "foo" $ echo bar > bar $ hg commit -qAm "bar" - $ hg forget foo --dry-run --confirm - abort: cannot specify both --dry-run and --confirm + $ hg forget foo --dry-run -i + abort: cannot specify both --dry-run and --interactive [255] - $ hg forget foo --config ui.interactive=True --confirm << EOF + $ hg forget foo --config ui.interactive=True -i << EOF > ? > n > EOF @@ -297,7 +297,7 @@ test --confirm option in forget ? - ? (display help) forget foo [Ynsa?] n - $ hg forget foo bar --config ui.interactive=True --confirm << EOF + $ hg forget foo bar --config ui.interactive=True -i << EOF > y > n > EOF @@ -308,14 +308,14 @@ test --confirm option in forget R bar $ hg up -qC . - $ hg forget foo bar --config ui.interactive=True --confirm << EOF + $ hg forget foo bar --config ui.interactive=True -i << EOF > s > EOF forget bar [Ynsa?] s $ hg st $ hg up -qC . - $ hg forget foo bar --config ui.interactive=True --confirm << EOF + $ hg forget foo bar --config ui.interactive=True -i << EOF > a > EOF forget bar [Ynsa?] a diff --git a/tests/test-completion.t b/tests/test-completion.t --- a/tests/test-completion.t +++ b/tests/test-completion.t @@ -232,7 +232,7 @@ Show all commands + options commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos diff: rev, change, text, git, binary, nodates, noprefix, show-function, reverse, ignore-all-space, ignore-space-change, ignore-blank-lines, ignore-space-at-eol, unified, stat, root, include, exclude, subrepos export: output, switch-parent, rev, text, git, binary, nodates, template - forget: include, exclude, dry-run, confirm + forget: interactive, include, exclude, dry-run init: ssh, remotecmd, insecure log: follow, follow-first, date, copies, keyword, rev, line-range, removed, only-merges, user, only-branch, branch, prune, patch, git, limit, no-merges, stat, graph, style, template, include, exclude merge: force, rev, preview, abort, tool