Show More
@@ -1079,10 +1079,11 b' def postcommitstatus(orig, repo, *args, ' | |||||
1079 | finally: |
|
1079 | finally: | |
1080 | repo.lfstatus = False |
|
1080 | repo.lfstatus = False | |
1081 |
|
1081 | |||
1082 |
def cmdutilforget(orig, ui, repo, match, prefix, explicitonly, dryrun, |
|
1082 | def cmdutilforget(orig, ui, repo, match, prefix, explicitonly, dryrun, | |
|
1083 | interactive): | |||
1083 | normalmatcher = composenormalfilematcher(match, repo[None].manifest()) |
|
1084 | normalmatcher = composenormalfilematcher(match, repo[None].manifest()) | |
1084 | bad, forgot = orig(ui, repo, normalmatcher, prefix, explicitonly, dryrun, |
|
1085 | bad, forgot = orig(ui, repo, normalmatcher, prefix, explicitonly, dryrun, | |
1085 |
|
|
1086 | interactive) | |
1086 | m = composelargefilematcher(match, repo[None].manifest()) |
|
1087 | m = composelargefilematcher(match, repo[None].manifest()) | |
1087 |
|
1088 | |||
1088 | try: |
|
1089 | try: |
@@ -2058,9 +2058,9 b' def addwebdirpath(repo, serverpath, webc' | |||||
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, |
|
2061 | def forget(ui, repo, match, prefix, explicitonly, dryrun, interactive): | |
2062 |
if dryrun and |
|
2062 | if dryrun and interactive: | |
2063 |
raise error.Abort(_("cannot specify both --dry-run and -- |
|
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) | |
@@ -2076,8 +2076,8 b' def forget(ui, repo, match, prefix, expl' | |||||
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 |
|
|
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: | |
@@ -2100,7 +2100,7 b' def forget(ui, repo, match, prefix, expl' | |||||
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' | |
@@ -2127,7 +2127,7 b' def forget(ui, repo, match, prefix, expl' | |||||
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 |
|
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: |
@@ -112,7 +112,6 b' globalopts = [' | |||||
112 | ] |
|
112 | ] | |
113 |
|
113 | |||
114 | dryrunopts = cmdutil.dryrunopts |
|
114 | dryrunopts = cmdutil.dryrunopts | |
115 | confirmopts = cmdutil.confirmopts |
|
|||
116 | remoteopts = cmdutil.remoteopts |
|
115 | remoteopts = cmdutil.remoteopts | |
117 | walkopts = cmdutil.walkopts |
|
116 | walkopts = cmdutil.walkopts | |
118 | commitopts = cmdutil.commitopts |
|
117 | commitopts = cmdutil.commitopts | |
@@ -2062,7 +2061,8 b' def files(ui, repo, *pats, **opts):' | |||||
2062 |
|
2061 | |||
2063 | @command( |
|
2062 | @command( | |
2064 | '^forget', |
|
2063 | '^forget', | |
2065 | walkopts + dryrunopts + confirmopts, |
|
2064 | [('i', 'interactive', None, _('use interactive mode')), | |
|
2065 | ] + walkopts + dryrunopts, | |||
2066 | _('[OPTION]... FILE...'), inferrepo=True) |
|
2066 | _('[OPTION]... FILE...'), inferrepo=True) | |
2067 | def forget(ui, repo, *pats, **opts): |
|
2067 | def forget(ui, repo, *pats, **opts): | |
2068 | """forget the specified files on the next commit |
|
2068 | """forget the specified files on the next commit | |
@@ -2098,10 +2098,10 b' def forget(ui, repo, *pats, **opts):' | |||||
2098 | raise error.Abort(_('no files specified')) |
|
2098 | raise error.Abort(_('no files specified')) | |
2099 |
|
2099 | |||
2100 | m = scmutil.match(repo[None], pats, opts) |
|
2100 | m = scmutil.match(repo[None], pats, opts) | |
2101 |
dryrun, |
|
2101 | dryrun, interactive = opts.get('dry_run'), opts.get('interactive') | |
2102 | rejected = cmdutil.forget(ui, repo, m, prefix="", |
|
2102 | rejected = cmdutil.forget(ui, repo, m, prefix="", | |
2103 | explicitonly=False, dryrun=dryrun, |
|
2103 | explicitonly=False, dryrun=dryrun, | |
2104 |
|
|
2104 | interactive=interactive)[0] | |
2105 | return rejected and 1 or 0 |
|
2105 | return rejected and 1 or 0 | |
2106 |
|
2106 | |||
2107 | @command( |
|
2107 | @command( |
@@ -352,7 +352,7 b' class abstractsubrepo(object):' | |||||
352 | matched by the match function |
|
352 | matched by the match function | |
353 | ''' |
|
353 | ''' | |
354 |
|
354 | |||
355 |
def forget(self, match, prefix, dryrun, |
|
355 | def forget(self, match, prefix, dryrun, interactive): | |
356 | return ([], []) |
|
356 | return ([], []) | |
357 |
|
357 | |||
358 | def removefiles(self, matcher, prefix, after, force, subrepos, |
|
358 | def removefiles(self, matcher, prefix, after, force, subrepos, | |
@@ -816,10 +816,10 b' class hgsubrepo(abstractsubrepo):' | |||||
816 | return ctx.walk(match) |
|
816 | return ctx.walk(match) | |
817 |
|
817 | |||
818 | @annotatesubrepoerror |
|
818 | @annotatesubrepoerror | |
819 |
def forget(self, match, prefix, dryrun, |
|
819 | def forget(self, match, prefix, dryrun, interactive): | |
820 | return cmdutil.forget(self.ui, self._repo, match, |
|
820 | return cmdutil.forget(self.ui, self._repo, match, | |
821 | self.wvfs.reljoin(prefix, self._path), |
|
821 | self.wvfs.reljoin(prefix, self._path), | |
822 |
True, dryrun=dryrun, |
|
822 | True, dryrun=dryrun, interactive=interactive) | |
823 |
|
823 | |||
824 | @annotatesubrepoerror |
|
824 | @annotatesubrepoerror | |
825 | def removefiles(self, matcher, prefix, after, force, subrepos, |
|
825 | def removefiles(self, matcher, prefix, after, force, subrepos, |
@@ -273,19 +273,19 b' test --dry-run mode in forget' | |||||
273 |
|
273 | |||
274 | $ cd .. |
|
274 | $ cd .. | |
275 |
|
275 | |||
276 |
test -- |
|
276 | test --interactive mode in forget | |
277 |
|
277 | |||
278 |
$ hg init forget |
|
278 | $ hg init interactiveforget | |
279 | $ cd forgetconfirm |
|
279 | $ cd interactiveforget | |
280 | $ echo foo > foo |
|
280 | $ echo foo > foo | |
281 | $ hg commit -qAm "foo" |
|
281 | $ hg commit -qAm "foo" | |
282 | $ echo bar > bar |
|
282 | $ echo bar > bar | |
283 | $ hg commit -qAm "bar" |
|
283 | $ hg commit -qAm "bar" | |
284 |
$ hg forget foo --dry-run - |
|
284 | $ hg forget foo --dry-run -i | |
285 |
abort: cannot specify both --dry-run and -- |
|
285 | abort: cannot specify both --dry-run and --interactive | |
286 | [255] |
|
286 | [255] | |
287 |
|
287 | |||
288 |
$ hg forget foo --config ui.interactive=True - |
|
288 | $ hg forget foo --config ui.interactive=True -i << EOF | |
289 | > ? |
|
289 | > ? | |
290 | > n |
|
290 | > n | |
291 | > EOF |
|
291 | > EOF | |
@@ -297,7 +297,7 b' test --confirm option in forget' | |||||
297 | ? - ? (display help) |
|
297 | ? - ? (display help) | |
298 | forget foo [Ynsa?] n |
|
298 | forget foo [Ynsa?] n | |
299 |
|
299 | |||
300 |
$ hg forget foo bar --config ui.interactive=True - |
|
300 | $ hg forget foo bar --config ui.interactive=True -i << EOF | |
301 | > y |
|
301 | > y | |
302 | > n |
|
302 | > n | |
303 | > EOF |
|
303 | > EOF | |
@@ -308,14 +308,14 b' test --confirm option in forget' | |||||
308 | R bar |
|
308 | R bar | |
309 | $ hg up -qC . |
|
309 | $ hg up -qC . | |
310 |
|
310 | |||
311 |
$ hg forget foo bar --config ui.interactive=True - |
|
311 | $ hg forget foo bar --config ui.interactive=True -i << EOF | |
312 | > s |
|
312 | > s | |
313 | > EOF |
|
313 | > EOF | |
314 | forget bar [Ynsa?] s |
|
314 | forget bar [Ynsa?] s | |
315 | $ hg st |
|
315 | $ hg st | |
316 | $ hg up -qC . |
|
316 | $ hg up -qC . | |
317 |
|
317 | |||
318 |
$ hg forget foo bar --config ui.interactive=True - |
|
318 | $ hg forget foo bar --config ui.interactive=True -i << EOF | |
319 | > a |
|
319 | > a | |
320 | > EOF |
|
320 | > EOF | |
321 | forget bar [Ynsa?] a |
|
321 | forget bar [Ynsa?] a |
@@ -232,7 +232,7 b' Show all commands + options' | |||||
232 | commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos |
|
232 | commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos | |
233 | 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 |
|
233 | 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 | |
234 | export: output, switch-parent, rev, text, git, binary, nodates, template |
|
234 | export: output, switch-parent, rev, text, git, binary, nodates, template | |
235 |
forget: include, exclude, dry-run |
|
235 | forget: interactive, include, exclude, dry-run | |
236 | init: ssh, remotecmd, insecure |
|
236 | init: ssh, remotecmd, insecure | |
237 | 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 |
|
237 | 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 | |
238 | merge: force, rev, preview, abort, tool |
|
238 | merge: force, rev, preview, abort, tool |
General Comments 0
You need to be logged in to leave comments.
Login now