Issue122

Title commit succeeds if merge fails
Priority feature Status resolved
Superseder Nosy List Omnifarious, ThomasAH, bos, brendan, junkblocker, kupfer, movement, mpm, tonfa
Assigned To Topics

Created on 2006-02-13.06:09:35 by bos, last changed 2008-11-22.21:13:52 by mpm.

Messages
msg7963 (view) Author: mpm Date: 2008-11-22.21:13:47
Yes.
msg7962 (view) Author: brendan Date: 2008-11-22.20:22:58
This is solved by the new merge/resolve machinery, isn't it?
msg2664 (view) Author: movement Date: 2007-01-06.13:53:08
Exactly... when you have a thousand people and tens of 'main' repos, that gets
fun quickly.
msg2663 (view) Author: tonfa Date: 2007-01-06.13:22:02
Same as hgeditor, you can enable it in ~/.hgrc
msg2662 (view) Author: movement Date: 2007-01-06.13:18:36
Except that each repo child has to set that by hand, right? Or is there someway
to set an hgrc on a clone?
msg2661 (view) Author: tonfa Date: 2007-01-06.13:16:46
no hgeditor isn't call with commit -m foo. on the other hand, a precommit hook
will work better.
msg2660 (view) Author: movement Date: 2007-01-06.13:14:26
What is hgeditor? Does it cover hg commit -m 'foo' ?
msg1173 (view) Author: mpm Date: 2006-05-08.14:22:57
I have yet to hear why adding three lines to hgeditor to find conflict markers
isn't sufficient. Nor am I clear on what "resolved" does.
msg1169 (view) Author: cboos Date: 2006-05-07.20:00:17
Thomas, sure if the dirstate can retain that info, that would be even better.
The essential thing would be to have a workflow supporting "hg merge", "hg status"
and "hg resolved".

movement: see
http://thread.gmane.org/gmane.comp.version-control.mercurial.devel/6655/focus=6687
msg1168 (view) Author: movement Date: 2006-05-06.10:09:16
What's the reasoning against looking for conflict markers? That they may be
arbitrary text?
msg1167 (view) Author: ThomasAH Date: 2006-05-06.09:28:18
cboos, I haven't thought about whether your solution is good or bad, but this  
shouldn't be done with a separate file. We have the dirstate for such things.
msg1166 (view) Author: cboos Date: 2006-05-06.08:03:06
As discussed recently on the mercurial list, Matt made it clear
that looking for merge/conflict markers was wrong.

Therefore I reiterate my alternative proposal:

In addition to just mentioning a merge failure when the merge 
script failed, hg merge should leave a file behind as a conflict
marker (that could be an empty file having the same filename,
with a ".conflict" suffix added).

The advantages of doing that at the Mercurial level instead of
doing this at the hgmerge script level are multiple:
 - custom hgmerge tool won't have to care about that, and 
   possibly forget to do it or do it wrong; therefore, the
   new mechanism will support already existing custom merge 
   tools,
 - "hg status" could check about those "xxx.conflict" files
   and appropriately flag those files as: C = conflicted.
 - "hg commit" could check about those "xxx.conflict" files
   and refuse to proceed, in case they're left around.
 - we'd need a "hg resolved" command which would remove 
   those conflict marker files; quite similar to the SVN situation.
msg1121 (view) Author: ThomasAH Date: 2006-05-02.16:48:35
Reopening this issue to discuss not allow committing a file with conflict
markers if working directory has two parents.
msg472 (view) Author: ThomasAH Date: 2006-02-13.11:57:48
There is already a discussion about this in issue12.
msg470 (view) Author: bos Date: 2006-02-13.06:09:30
Mercurial lets a commit succeed if a merge fails.  Here's what I mean:

    $ hg init a
    $ echo a > a/a
    $ hg --cwd a commit -Am a
    adding a
    $ hg clone a b
    $ echo b > a/a
    $ hg --cwd a commit -m b
    $ echo c > b/a
    $ hg --cwd b commit -m c
    $ hg --cwd a pull ../b
    added 1 changesets with 1 changes to 1 files (+1 heads)
    $ HGMERGE=merge --cwd a up -m
    merging a
    merge: warning: conflicts during merge
    merging a failed!

This leaves unmerged files with commit markers littering their internals.

It's pretty easy to do this by mistake.

By default, commit should abort if the dirstate has two parents and any files
contain merge markers.  This could be overridden with -f.

An alternative would be to provide a precommit hook in contrib, but I'd prefer
the default behaviour to change instead, as it's not nice to make it easy for
users to shoot themselves in the foot.
History
Date User Action Args
2008-11-22 21:13:52mpmsetstatus: chatting -> resolved
nosy: mpm, Omnifarious, bos, ThomasAH, tonfa, brendan, movement, junkblocker, kupfer
messages: + msg7963
2008-11-22 20:22:59brendansetnosy: + brendan
messages: + msg7962
2007-01-06 13:53:08movementsetnosy: mpm, Omnifarious, bos, ThomasAH, tonfa, movement, junkblocker, kupfer
messages: + msg2664
2007-01-06 13:22:02tonfasetnosy: mpm, Omnifarious, bos, ThomasAH, tonfa, movement, junkblocker, kupfer
messages: + msg2663
2007-01-06 13:18:36movementsetnosy: mpm, Omnifarious, bos, ThomasAH, tonfa, movement, junkblocker, kupfer
messages: + msg2662
2007-01-06 13:16:46tonfasetnosy: mpm, Omnifarious, bos, ThomasAH, tonfa, movement, junkblocker, kupfer
messages: + msg2661
2007-01-06 13:14:26movementsetnosy: mpm, Omnifarious, bos, ThomasAH, tonfa, movement, junkblocker, kupfer
messages: + msg2660
2006-05-08 14:22:57mpmsetnosy: mpm, Omnifarious, bos, ThomasAH, tonfa, movement, junkblocker, kupfer
messages: + msg1173
2006-05-07 20:00:22cboossetnosy: mpm, Omnifarious, bos, ThomasAH, tonfa, movement, junkblocker, kupfer
messages: + msg1169
2006-05-06 10:09:16movementsetnosy: mpm, Omnifarious, bos, ThomasAH, tonfa, movement, junkblocker, kupfer
messages: + msg1168
2006-05-06 09:28:18ThomasAHsetnosy: mpm, Omnifarious, bos, ThomasAH, tonfa, movement, junkblocker, kupfer
messages: + msg1167
2006-05-06 08:03:22cboossetnosy: mpm, Omnifarious, bos, ThomasAH, tonfa, movement, junkblocker, kupfer
messages: + msg1166
2006-05-02 16:48:35ThomasAHsetstatus: resolved -> chatting
nosy: + mpm, movement, Omnifarious, tonfa, kupfer, junkblocker
superseder: - update -m should handle errors during merge more gracefully
messages: + msg1121
2006-02-13 11:57:49ThomasAHsetpriority: bug -> feature
status: unread -> resolved
superseder: + update -m should handle errors during merge more gracefully
messages: + msg472
nosy: + ThomasAH
2006-02-13 06:09:35boscreate