Mercurial > hg
diff mercurial/merge.py @ 23420:902554884335 stable 3.2.2
merge: before cd/dc prompt, check that changed side really changed
Before, merging would in some cases ask "wrong" questions about
"changed/deleted" conflicts ... and even do it before the resolve phase where
they can be postponed, re"resolved" or answered in bulk operations.
Instead, check that the content of the changed file really did change.
Reading and comparing file content is expensive and should be avoided before
the resolve phase. Prompting the user is however even more expensive. Checking
the content here is thus better.
The 'f in ancestors[0]' should not be necessary but is included to be extra
safe.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Mon, 01 Dec 2014 02:30:21 +0100 |
parents | ff93aa006e6a |
children | 19ebd2f88fc7 30b602168c3b |
line wrap: on
line diff
--- a/mercurial/merge.py Mon Dec 01 02:11:29 2014 +0100 +++ b/mercurial/merge.py Mon Dec 01 02:30:21 2014 +0100 @@ -827,7 +827,10 @@ # Prompt and create actions. TODO: Move this towards resolve phase. for f, args, msg in actions['cd']: - if repo.ui.promptchoice( + if f in ancestors[0] and not wctx[f].cmp(ancestors[0][f]): + # local did change but ended up with same content + actions['r'].append((f, None, "prompt same")) + elif repo.ui.promptchoice( _("local changed %s which remote deleted\n" "use (c)hanged version or (d)elete?" "$$ &Changed $$ &Delete") % f, 0): @@ -838,7 +841,10 @@ for f, args, msg in actions['dc']: flags, = args - if repo.ui.promptchoice( + if f in ancestors[0] and not mctx[f].cmp(ancestors[0][f]): + # remote did change but ended up with same content + pass # don't get = keep local deleted + elif repo.ui.promptchoice( _("remote changed %s which local deleted\n" "use (c)hanged version or leave (d)eleted?" "$$ &Changed $$ &Deleted") % f, 0) == 0: