[issue3011] update with unresolved merge conflicts clears merge state

Greg Ward bugs at mercurial.selenic.com
Thu Sep 15 14:52:12 CDT 2011


New submission from Greg Ward <greg-hg at gerg.ca>:

If you use 'hg update' to merge uncommitted changes with upstream, that can
result in unresolved merge conflicts. You can see them with 'hg resolve -l'.
But if you run 'hg update' again, it clears the merge state while leaving
conflict markers in the unresolved files. This could allow accidentally
committing a file with conflict markers -- oops!

Example:

$ hg init test
$ cd test
$ echo a > a
$ hg ci -Am'add a'
adding a
$ echo a >> a
$ hg ci -Am'modify a'
$ hg up 0
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ echo 'conflict here' >> a
$ HGMERGE=internal:merge hg update
merging a
warning: conflicts during merge.
merging a failed!
0 files updated, 0 files merged, 0 files removed, 1 files unresolved
use 'hg resolve' to retry unresolved file merges
$ hg resolve -l
U a
$ hg update
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg resolve -l
$ cat a
a
<<<<<<< local
conflict here
=======
a
>>>>>>> other
$ hg ci -m'conflicts in a'

Two possible fixes:

1) 'hg update' should refuse to update if there are unresolved conflicts
   (although --clean should probably override that)

2) 'hg update' should preserve merge state

----------
messages: 17479
nosy: gward
priority: bug
status: unread
title: update with unresolved merge conflicts clears merge state

____________________________________________________
Mercurial issue tracker <bugs at mercurial.selenic.com>
<http://mercurial.selenic.com/bts/issue3011>
____________________________________________________


More information about the Mercurial-devel mailing list