Mercurial > hg
changeset 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 | a34a99181f36 |
children | c69734a9a638 |
files | mercurial/merge.py tests/test-issue3084.t |
diffstat | 2 files changed, 11 insertions(+), 15 deletions(-) [+] |
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:
--- a/tests/test-issue3084.t Mon Dec 01 02:11:29 2014 +0100 +++ b/tests/test-issue3084.t Mon Dec 01 02:30:21 2014 +0100 @@ -262,8 +262,6 @@ $ hg up -Cqr normal-same $ hg merge -r large - local changed f which remote deleted - use (c)hanged version or (d)elete? c getting changed largefiles 1 largefiles updated, 0 removed 1 files updated, 0 files merged, 1 files removed, 0 files unresolved @@ -275,11 +273,9 @@ $ hg up -Cqr large $ hg merge -r normal-same - remote changed f which local deleted - use (c)hanged version or leave (d)eleted? c getting changed largefiles - 1 largefiles updated, 0 removed - 1 files updated, 0 files merged, 1 files removed, 0 files unresolved + 0 largefiles updated, 0 removed + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ cat f large @@ -387,8 +383,6 @@ $ hg up -Cqr large-same $ hg merge -r normal - local changed .hglf/f which remote deleted - use (c)hanged version or (d)elete? c getting changed largefiles 0 largefiles updated, 0 removed 1 files updated, 0 files merged, 1 files removed, 0 files unresolved @@ -400,11 +394,7 @@ $ hg up -Cqr normal $ hg merge -r large-same - remote changed .hglf/f which local deleted - use (c)hanged version or leave (d)eleted? c - getting changed largefiles - 0 largefiles updated, 0 removed - 1 files updated, 0 files merged, 1 files removed, 0 files unresolved + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ cat f normal