Submitter | Pierre-Yves David |
---|---|
Date | April 11, 2015, 4:32 p.m. |
Message ID | <83a202ecaff8e5fb3328.1428769976@marginatus.alto.octopoid.net> |
Download | mbox | patch |
Permalink | /patch/8619/ |
State | Accepted |
Headers | show |
Comments
On Sat, Apr 11, 2015 at 9:34 AM Pierre-Yves David < pierre-yves.david@ens-lyon.org> wrote: > # HG changeset patch > # User Pierre-Yves David <pierre-yves.david@fb.com> > # Date 1428769614 14400 > # Sat Apr 11 12:26:54 2015 -0400 > # Node ID 83a202ecaff8e5fb3328a931d6c414960a5a0d30 > # Parent 207e295aecc5bc8e728ec4c58674171167d034a5 > revert: do not requires '--all' if '--interative' is present > > The '--all' option have been introduced in 890e285c52a1 (August 2006), most > probably to prevent user shotting themselves in the foot. As the record > process > will let you, view and select the set of files and change you want to > revert, I > feel like the '--all' flag is superfluous in the '--interactive' case. > Makes sense to me. I'm pushing this to the clowncopter. > > diff --git a/mercurial/commands.py b/mercurial/commands.py > --- a/mercurial/commands.py > +++ b/mercurial/commands.py > @@ -5512,11 +5512,11 @@ def revert(ui, repo, *pats, **opts): > raise util.Abort(_('uncommitted merge with no revision > specified'), > hint=_('use "hg update" or see "hg help > revert"')) > > ctx = scmutil.revsingle(repo, opts.get('rev')) > > - if not pats and not opts.get('all'): > + if not pats and not (opts.get('all') or opts.get('interactive')): > msg = _("no files or directories specified") > if p2 != nullid: > hint = _("uncommitted merge, use --all to discard all > changes," > " or 'hg update -C .' to abort the merge") > raise util.Abort(msg, hint=hint) > diff --git a/tests/test-revert-interactive.t > b/tests/test-revert-interactive.t > --- a/tests/test-revert-interactive.t > +++ b/tests/test-revert-interactive.t > @@ -119,10 +119,25 @@ 10 run the same test than 8 from within > 2 > 3 > 4 > 5 > f > + > +Test that --interative lift the need for --all > + > + $ echo q | hg revert -i -r 2 > + reverting folder1/g (glob) > + reverting folder2/h (glob) > + diff -r 89ac3d72e4a4 folder1/g > + 1 hunks, 1 lines changed > + examine changes to 'folder1/g'? [Ynesfdaq?] q > + > + abort: user quit > + [255] > + $ rm folder1/g.orig > + > + > $ hg update -C 6 > 3 files updated, 0 files merged, 0 files removed, 0 files unresolved > $ hg revert -i -r 2 --all -- << EOF > > y > > y > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@selenic.com > http://selenic.com/mailman/listinfo/mercurial-devel >
Patch
diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -5512,11 +5512,11 @@ def revert(ui, repo, *pats, **opts): raise util.Abort(_('uncommitted merge with no revision specified'), hint=_('use "hg update" or see "hg help revert"')) ctx = scmutil.revsingle(repo, opts.get('rev')) - if not pats and not opts.get('all'): + if not pats and not (opts.get('all') or opts.get('interactive')): msg = _("no files or directories specified") if p2 != nullid: hint = _("uncommitted merge, use --all to discard all changes," " or 'hg update -C .' to abort the merge") raise util.Abort(msg, hint=hint) diff --git a/tests/test-revert-interactive.t b/tests/test-revert-interactive.t --- a/tests/test-revert-interactive.t +++ b/tests/test-revert-interactive.t @@ -119,10 +119,25 @@ 10 run the same test than 8 from within 2 3 4 5 f + +Test that --interative lift the need for --all + + $ echo q | hg revert -i -r 2 + reverting folder1/g (glob) + reverting folder2/h (glob) + diff -r 89ac3d72e4a4 folder1/g + 1 hunks, 1 lines changed + examine changes to 'folder1/g'? [Ynesfdaq?] q + + abort: user quit + [255] + $ rm folder1/g.orig + + $ hg update -C 6 3 files updated, 0 files merged, 0 files removed, 0 files unresolved $ hg revert -i -r 2 --all -- << EOF > y > y