forget: rename --confirm to --interactive
authorSushil khanchi <sushilkhanchi97@gmail.com>
Wed, 18 Apr 2018 19:25:35 +0530
changeset 37778 f10cb49951e1
parent 37777 a4cac7b0ea4f
child 37779 379d54eae6eb
forget: rename --confirm to --interactive Differential Revision: https://phab.mercurial-scm.org/D3405
hgext/largefiles/overrides.py
mercurial/cmdutil.py
mercurial/commands.py
mercurial/subrepo.py
tests/test-add.t
tests/test-completion.t
--- a/hgext/largefiles/overrides.py	Tue Apr 17 13:46:18 2018 +0200
+++ b/hgext/largefiles/overrides.py	Wed Apr 18 19:25:35 2018 +0530
@@ -1079,10 +1079,11 @@
     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:
--- a/mercurial/cmdutil.py	Tue Apr 17 13:46:18 2018 +0200
+++ b/mercurial/cmdutil.py	Wed Apr 18 19:25:35 2018 +0530
@@ -2058,9 +2058,9 @@
         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 @@
         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 @@
                                 % match.rel(f))
                     bad.append(f)
 
-    if confirm:
+    if interactive:
         responses = _('[Ynsa?]'
                       '$$ &Yes, forget this file'
                       '$$ &No, skip this file'
@@ -2127,7 +2127,7 @@
                 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:
--- a/mercurial/commands.py	Tue Apr 17 13:46:18 2018 +0200
+++ b/mercurial/commands.py	Wed Apr 18 19:25:35 2018 +0530
@@ -112,7 +112,6 @@
 ]
 
 dryrunopts = cmdutil.dryrunopts
-confirmopts = cmdutil.confirmopts
 remoteopts = cmdutil.remoteopts
 walkopts = cmdutil.walkopts
 commitopts = cmdutil.commitopts
@@ -2062,7 +2061,8 @@
 
 @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 @@
         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(
--- a/mercurial/subrepo.py	Tue Apr 17 13:46:18 2018 +0200
+++ b/mercurial/subrepo.py	Wed Apr 18 19:25:35 2018 +0530
@@ -352,7 +352,7 @@
         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 @@
         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,
--- a/tests/test-add.t	Tue Apr 17 13:46:18 2018 +0200
+++ b/tests/test-add.t	Wed Apr 18 19:25:35 2018 +0530
@@ -273,19 +273,19 @@
 
   $ 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 @@
   ? - ? (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 @@
   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
--- a/tests/test-completion.t	Tue Apr 17 13:46:18 2018 +0200
+++ b/tests/test-completion.t	Wed Apr 18 19:25:35 2018 +0530
@@ -232,7 +232,7 @@
   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