[PATCH V2] forget: add --dry-run mode

sushil khanchi sushilkhanchi97 at gmail.com
Tue Mar 13 17:30:55 EDT 2018


Shall I remove --dry-run from context layer now?

On Tue, Mar 13, 2018 at 7:55 PM, Yuya Nishihara <yuya at tcha.org> wrote:

> On Mon, 12 Mar 2018 18:27:13 -0400, Matt Harbison wrote:
> > On Sun, 11 Mar 2018 05:49:26 -0400, Sushil khanchi
> > <sushilkhanchi97 at gmail.com> wrote:
> >
> > > # HG changeset patch
> > > # User Sushil khanchi <sushilkhanchi97 at gmail.com>
> > > # Date 1520665399 -19800
> > > #      Sat Mar 10 12:33:19 2018 +0530
> > > # Node ID a1be8989c0158abc69ebd97ca8a0cc7dc3801be9
> > > # Parent  4c71a26a4009d88590c9ae3d64a5912fd556d82e
> > > forget: add --dry-run mode
> > >
> > > diff -r 4c71a26a4009 -r a1be8989c015 mercurial/cmdutil.py
> > > --- a/mercurial/cmdutil.py  Sun Mar 04 21:16:36 2018 -0500
> > > +++ b/mercurial/cmdutil.py  Sat Mar 10 12:33:19 2018 +0530
> > > @@ -1996,7 +1996,7 @@
> > >          for subpath in ctx.substate:
> > >              ctx.sub(subpath).addwebdirpath(serverpath, webconf)
> > > -def forget(ui, repo, match, prefix, explicitonly):
> > > +def forget(ui, repo, match, prefix, explicitonly, **opts):
> > >      join = lambda f: os.path.join(prefix, f)
> > >      bad = []
> > >      badfn = lambda x, y: bad.append(x) or match.bad(x, y)
> > > @@ -2039,9 +2039,10 @@
> > >          if ui.verbose or not match.exact(f):
> > >              ui.status(_('removing %s\n') % match.rel(f))
> > > -    rejected = wctx.forget(forget, prefix)
> >
> > Shouldn't --dry-run be passed into wctx.forget() too?  Then the warning
> > about bad paths there will be emitted, and you won't have to
> > conditionalize the following lines here.  That in turn won't affect the
> > exit code.
>
> I slightly prefer not to pass --dry-run deep into the context layer
> because it's a command-line business. Just my two cents.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20180314/7dce35ec/attachment.html>


More information about the Mercurial-devel mailing list