comparison mercurial/commands.py @ 37756:e7bf5a73e4e1

forget: add --confirm option Also added confirmopts in cmdutil.py Differential Revision: https://phab.mercurial-scm.org/D2934
author Sushil khanchi <sushilkhanchi97@gmail.com>
date Thu, 22 Mar 2018 16:11:42 +0530
parents dfc51a482031
children 9b3a348c9b2f
comparison
equal deleted inserted replaced
37755:886754323bed 37756:e7bf5a73e4e1
110 ('', 'pager', 'auto', 110 ('', 'pager', 'auto',
111 _("when to paginate (boolean, always, auto, or never)"), _('TYPE')), 111 _("when to paginate (boolean, always, auto, or never)"), _('TYPE')),
112 ] 112 ]
113 113
114 dryrunopts = cmdutil.dryrunopts 114 dryrunopts = cmdutil.dryrunopts
115 confirmopts = cmdutil.confirmopts
115 remoteopts = cmdutil.remoteopts 116 remoteopts = cmdutil.remoteopts
116 walkopts = cmdutil.walkopts 117 walkopts = cmdutil.walkopts
117 commitopts = cmdutil.commitopts 118 commitopts = cmdutil.commitopts
118 commitopts2 = cmdutil.commitopts2 119 commitopts2 = cmdutil.commitopts2
119 formatteropts = cmdutil.formatteropts 120 formatteropts = cmdutil.formatteropts
2058 with ui.formatter('files', opts) as fm: 2059 with ui.formatter('files', opts) as fm:
2059 return cmdutil.files(ui, ctx, m, fm, fmt, opts.get('subrepos')) 2060 return cmdutil.files(ui, ctx, m, fm, fmt, opts.get('subrepos'))
2060 2061
2061 @command( 2062 @command(
2062 '^forget', 2063 '^forget',
2063 walkopts + dryrunopts, 2064 walkopts + dryrunopts + confirmopts,
2064 _('[OPTION]... FILE...'), inferrepo=True) 2065 _('[OPTION]... FILE...'), inferrepo=True)
2065 def forget(ui, repo, *pats, **opts): 2066 def forget(ui, repo, *pats, **opts):
2066 """forget the specified files on the next commit 2067 """forget the specified files on the next commit
2067 2068
2068 Mark the specified files so they will no longer be tracked 2069 Mark the specified files so they will no longer be tracked
2094 opts = pycompat.byteskwargs(opts) 2095 opts = pycompat.byteskwargs(opts)
2095 if not pats: 2096 if not pats:
2096 raise error.Abort(_('no files specified')) 2097 raise error.Abort(_('no files specified'))
2097 2098
2098 m = scmutil.match(repo[None], pats, opts) 2099 m = scmutil.match(repo[None], pats, opts)
2099 dryrun = opts.get('dry_run') 2100 dryrun, confirm = opts.get('dry_run'), opts.get('confirm')
2100 rejected = cmdutil.forget(ui, repo, m, prefix="", 2101 rejected = cmdutil.forget(ui, repo, m, prefix="",
2101 explicitonly=False, dryrun=dryrun)[0] 2102 explicitonly=False, dryrun=dryrun,
2103 confirm=confirm)[0]
2102 return rejected and 1 or 0 2104 return rejected and 1 or 0
2103 2105
2104 @command( 2106 @command(
2105 'graft', 2107 'graft',
2106 [('r', 'rev', [], _('revisions to graft'), _('REV')), 2108 [('r', 'rev', [], _('revisions to graft'), _('REV')),