Show More
@@ -1079,10 +1079,11 def postcommitstatus(orig, repo, *args, | |||
|
1079 | 1079 | finally: |
|
1080 | 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 | 1084 | normalmatcher = composenormalfilematcher(match, repo[None].manifest()) |
|
1084 | 1085 | bad, forgot = orig(ui, repo, normalmatcher, prefix, explicitonly, dryrun, |
|
1085 |
|
|
|
1086 | interactive) | |
|
1086 | 1087 | m = composelargefilematcher(match, repo[None].manifest()) |
|
1087 | 1088 | |
|
1088 | 1089 | try: |
@@ -2058,9 +2058,9 def addwebdirpath(repo, serverpath, webc | |||
|
2058 | 2058 | for subpath in ctx.substate: |
|
2059 | 2059 | ctx.sub(subpath).addwebdirpath(serverpath, webconf) |
|
2060 | 2060 | |
|
2061 |
def forget(ui, repo, match, prefix, explicitonly, dryrun, |
|
|
2062 |
if dryrun and |
|
|
2063 |
raise error.Abort(_("cannot specify both --dry-run and -- |
|
|
2061 | def forget(ui, repo, match, prefix, explicitonly, dryrun, interactive): | |
|
2062 | if dryrun and interactive: | |
|
2063 | raise error.Abort(_("cannot specify both --dry-run and --interactive")) | |
|
2064 | 2064 | join = lambda f: os.path.join(prefix, f) |
|
2065 | 2065 | bad = [] |
|
2066 | 2066 | badfn = lambda x, y: bad.append(x) or match.bad(x, y) |
@@ -2076,8 +2076,8 def forget(ui, repo, match, prefix, expl | |||
|
2076 | 2076 | sub = wctx.sub(subpath) |
|
2077 | 2077 | try: |
|
2078 | 2078 | submatch = matchmod.subdirmatcher(subpath, match) |
|
2079 | subbad, subforgot = sub.forget(submatch, prefix, | |
|
2080 |
|
|
|
2079 | subbad, subforgot = sub.forget(submatch, prefix, dryrun=dryrun, | |
|
2080 | interactive=interactive) | |
|
2081 | 2081 | bad.extend([subpath + '/' + f for f in subbad]) |
|
2082 | 2082 | forgot.extend([subpath + '/' + f for f in subforgot]) |
|
2083 | 2083 | except error.LookupError: |
@@ -2100,7 +2100,7 def forget(ui, repo, match, prefix, expl | |||
|
2100 | 2100 | % match.rel(f)) |
|
2101 | 2101 | bad.append(f) |
|
2102 | 2102 | |
|
2103 | if confirm: | |
|
2103 | if interactive: | |
|
2104 | 2104 | responses = _('[Ynsa?]' |
|
2105 | 2105 | '$$ &Yes, forget this file' |
|
2106 | 2106 | '$$ &No, skip this file' |
@@ -2127,7 +2127,7 def forget(ui, repo, match, prefix, expl | |||
|
2127 | 2127 | break |
|
2128 | 2128 | |
|
2129 | 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 | 2131 | ui.status(_('removing %s\n') % match.rel(f)) |
|
2132 | 2132 | |
|
2133 | 2133 | if not dryrun: |
@@ -112,7 +112,6 globalopts = [ | |||
|
112 | 112 | ] |
|
113 | 113 | |
|
114 | 114 | dryrunopts = cmdutil.dryrunopts |
|
115 | confirmopts = cmdutil.confirmopts | |
|
116 | 115 | remoteopts = cmdutil.remoteopts |
|
117 | 116 | walkopts = cmdutil.walkopts |
|
118 | 117 | commitopts = cmdutil.commitopts |
@@ -2062,7 +2061,8 def files(ui, repo, *pats, **opts): | |||
|
2062 | 2061 | |
|
2063 | 2062 | @command( |
|
2064 | 2063 | '^forget', |
|
2065 | walkopts + dryrunopts + confirmopts, | |
|
2064 | [('i', 'interactive', None, _('use interactive mode')), | |
|
2065 | ] + walkopts + dryrunopts, | |
|
2066 | 2066 | _('[OPTION]... FILE...'), inferrepo=True) |
|
2067 | 2067 | def forget(ui, repo, *pats, **opts): |
|
2068 | 2068 | """forget the specified files on the next commit |
@@ -2098,10 +2098,10 def forget(ui, repo, *pats, **opts): | |||
|
2098 | 2098 | raise error.Abort(_('no files specified')) |
|
2099 | 2099 | |
|
2100 | 2100 | m = scmutil.match(repo[None], pats, opts) |
|
2101 |
dryrun, |
|
|
2101 | dryrun, interactive = opts.get('dry_run'), opts.get('interactive') | |
|
2102 | 2102 | rejected = cmdutil.forget(ui, repo, m, prefix="", |
|
2103 | 2103 | explicitonly=False, dryrun=dryrun, |
|
2104 |
|
|
|
2104 | interactive=interactive)[0] | |
|
2105 | 2105 | return rejected and 1 or 0 |
|
2106 | 2106 | |
|
2107 | 2107 | @command( |
@@ -352,7 +352,7 class abstractsubrepo(object): | |||
|
352 | 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 | 356 | return ([], []) |
|
357 | 357 | |
|
358 | 358 | def removefiles(self, matcher, prefix, after, force, subrepos, |
@@ -816,10 +816,10 class hgsubrepo(abstractsubrepo): | |||
|
816 | 816 | return ctx.walk(match) |
|
817 | 817 | |
|
818 | 818 | @annotatesubrepoerror |
|
819 |
def forget(self, match, prefix, dryrun, |
|
|
819 | def forget(self, match, prefix, dryrun, interactive): | |
|
820 | 820 | return cmdutil.forget(self.ui, self._repo, match, |
|
821 | 821 | self.wvfs.reljoin(prefix, self._path), |
|
822 |
True, dryrun=dryrun, |
|
|
822 | True, dryrun=dryrun, interactive=interactive) | |
|
823 | 823 | |
|
824 | 824 | @annotatesubrepoerror |
|
825 | 825 | def removefiles(self, matcher, prefix, after, force, subrepos, |
@@ -273,19 +273,19 test --dry-run mode in forget | |||
|
273 | 273 | |
|
274 | 274 | $ cd .. |
|
275 | 275 | |
|
276 |
test -- |
|
|
276 | test --interactive mode in forget | |
|
277 | 277 | |
|
278 |
$ hg init forget |
|
|
279 | $ cd forgetconfirm | |
|
278 | $ hg init interactiveforget | |
|
279 | $ cd interactiveforget | |
|
280 | 280 | $ echo foo > foo |
|
281 | 281 | $ hg commit -qAm "foo" |
|
282 | 282 | $ echo bar > bar |
|
283 | 283 | $ hg commit -qAm "bar" |
|
284 |
$ hg forget foo --dry-run - |
|
|
285 |
abort: cannot specify both --dry-run and -- |
|
|
284 | $ hg forget foo --dry-run -i | |
|
285 | abort: cannot specify both --dry-run and --interactive | |
|
286 | 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 | 290 | > n |
|
291 | 291 | > EOF |
@@ -297,7 +297,7 test --confirm option in forget | |||
|
297 | 297 | ? - ? (display help) |
|
298 | 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 | 301 | > y |
|
302 | 302 | > n |
|
303 | 303 | > EOF |
@@ -308,14 +308,14 test --confirm option in forget | |||
|
308 | 308 | R bar |
|
309 | 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 | 312 | > s |
|
313 | 313 | > EOF |
|
314 | 314 | forget bar [Ynsa?] s |
|
315 | 315 | $ hg st |
|
316 | 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 | 319 | > a |
|
320 | 320 | > EOF |
|
321 | 321 | forget bar [Ynsa?] a |
@@ -232,7 +232,7 Show all commands + options | |||
|
232 | 232 | commit: addremove, close-branch, amend, secret, edit, interactive, include, exclude, message, logfile, date, user, subrepos |
|
233 | 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 | 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 | 236 | init: ssh, remotecmd, insecure |
|
237 | 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 | 238 | merge: force, rev, preview, abort, tool |
General Comments 0
You need to be logged in to leave comments.
Login now