Bug 2915 - 'hg revert file...' on an uncommitted merge now proceeds silently
Summary: 'hg revert file...' on an uncommitted merge now proceeds silently
Status: RESOLVED FIXED
Alias: None
Product: Mercurial
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: unspecified
Hardware: All All
: urgent bug
Assignee: Bugzilla
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-21 11:13 UTC by Jesse Glick
Modified: 2012-05-13 04:52 UTC (History)
5 users (show)

See Also:
Python Version: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2011-07-21 11:13 UTC
Thread: "[PATCH RFC] revert: add --force option"

Prior to 1.9, when running 'hg revert' on an uncommitted merge, you had to
(a) pass either -a or some files, (b) and pass '-r .'. Now as of
afe0d4c24866 someone can revert some files in the working copy to the first
merge parent and then commit, effectively backing out all work done in those
files, without any warnings being displayed. This is a particular risk for
novice users encountering merge conflicts and becoming confused by
uncommitted modifications coming from the second merge parent.

At least before, they would get an error message and be forced to pass '-r .'.
Comment 1 HG Bot 2011-07-22 17:00 UTC
Fixed by http://selenic.com/repo/hg/rev/a934b9249574
Matt Mackall <mpm@selenic.com>
revert: restore check for uncommitted merge (issue2915) (BC)

(please test the fix)
Comment 2 Jesse Glick 2011-07-26 08:52 UTC
Backout does appear to restore pre-1.9 behavior as expected. Would still
suggest an explicit warning about the possible consequences from revert on a
merge (even with -r. file...) and accompanying help text, but this would be
a separate issue.
Comment 3 Matt Mackall 2011-07-26 11:51 UTC
It works for me:

$ hg sum
parent: 2:053c740ae2ab tip
 2
parent: 1:74c87a2fdc75 
 1
branch: default
commit: 1 modified, 1 removed (merge)
update: (current)

$ hg revert -a
abort: uncommitted merge with no revision specified
(use "hg update" or see "hg help revert")
Comment 4 THURNER rupert 2011-08-09 10:30 UTC
how does this solve the "for every do there must be an undo" which is so 
appreciated by novice users?

the workflow now is again back to:
1. hg merge
2. hg revert
--> error message
3. hg update
--> error message
4. hg help revert 
--> long text not specific to the situation before
5. swear and contact support if there is one

there should be a better way to cope with the problem, better help text or 
just accept that nonsense can be committed. then stripe it from the 
repository if you did not publish it, or revert this commit.
Comment 5 Matt Mackall 2011-08-09 10:35 UTC
The issues relevant to this bug are resolved, closing. Other issues need
their own bug reports.
Comment 6 Bugzilla 2012-05-12 09:21 UTC

--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:21 EDT  ---

This bug was previously known as _bug_ 2915 at http://mercurial.selenic.com/bts/issue2915