Issue1049

Title Hg permits partial commit of merge without warning
Priority urgent Status resolved
Superseder Nosy List abuehl, bos, djc, jglick, mzlamal
Assigned To bos Topics merge, surprise

Created on 2008-03-24.21:41:12 by jglick, last changed 2008-03-24.23:39:12 by djc.

Messages
msg5713 (view) Author: djc Date: 2008-03-24.23:39:09
In main, resolving.
msg5712 (view) Author: bos Date: 2008-03-24.22:51:51
Fixed in bae2e9c838e9.
msg5711 (view) Author: jglick Date: 2008-03-24.21:41:10
I have found that Hg lets you commit a specific file or dir list from a merge
working copy (i.e. with two parents), without printing any kind of warning. This
is a really bad idea because a novice user could do something like this:

$ hg clone ...
$ # edit myfile
$ hg di
--- myfile
+++ myfile
....
$ hg ci -m 'edited my file'
$ hg push
there are remote changes, merge
$ hg fetch
merging myfile...
# merge tool pops up on myfile, user closes
318 files updates, 1 files merged, 22 files removed, 0 files unresolved
don't forget to commit
$ hg ci -m 'merged' myfile
$ hg push
there are remote changes, merge
$ hg fetch
there are local changes!
$ hg up -C
...
$ hg fetch
...OK...
$ hg push

and effectively revert everyone else's work.

(I have documented evidence of someone at least doing the commit on a particular
file, though in this case rather than using up -C he committed the remaining
files as a separate non-merge changeset, so the end result luckily did not lose
any changes. I suspect that known cases of bad merges which did lose work were
the result of people following something like the sequence above.)

IMHO Mercurial should not permit a commit of a specific file or dir list to
proceed when that would create a merge changeset, as the resulting changeset
would not accurately reflect the true merge of its parents. (Perhaps there could
be a --force option to override this check.) If you really wanted to discard
some changes from one of the parents, you can always run 'hg revert'.
History
Date User Action Args
2008-03-24 23:39:12djcsetstatus: testing -> resolved
nosy: + djc
messages: + msg5713
2008-03-24 22:51:53bossetstatus: unread -> testing
nosy: bos, jglick, abuehl, mzlamal
messages: + msg5712
assignedto: bos
2008-03-24 22:49:15abuehlsetnosy: + abuehl
2008-03-24 21:41:12jglickcreate