Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
23419:a34a99181f36 | 23420:902554884335 |
---|---|
825 continue | 825 continue |
826 repo.ui.note(_('end of auction\n\n')) | 826 repo.ui.note(_('end of auction\n\n')) |
827 | 827 |
828 # Prompt and create actions. TODO: Move this towards resolve phase. | 828 # Prompt and create actions. TODO: Move this towards resolve phase. |
829 for f, args, msg in actions['cd']: | 829 for f, args, msg in actions['cd']: |
830 if repo.ui.promptchoice( | 830 if f in ancestors[0] and not wctx[f].cmp(ancestors[0][f]): |
831 # local did change but ended up with same content | |
832 actions['r'].append((f, None, "prompt same")) | |
833 elif repo.ui.promptchoice( | |
831 _("local changed %s which remote deleted\n" | 834 _("local changed %s which remote deleted\n" |
832 "use (c)hanged version or (d)elete?" | 835 "use (c)hanged version or (d)elete?" |
833 "$$ &Changed $$ &Delete") % f, 0): | 836 "$$ &Changed $$ &Delete") % f, 0): |
834 actions['r'].append((f, None, "prompt delete")) | 837 actions['r'].append((f, None, "prompt delete")) |
835 else: | 838 else: |
836 actions['a'].append((f, None, "prompt keep")) | 839 actions['a'].append((f, None, "prompt keep")) |
837 del actions['cd'][:] | 840 del actions['cd'][:] |
838 | 841 |
839 for f, args, msg in actions['dc']: | 842 for f, args, msg in actions['dc']: |
840 flags, = args | 843 flags, = args |
841 if repo.ui.promptchoice( | 844 if f in ancestors[0] and not mctx[f].cmp(ancestors[0][f]): |
845 # remote did change but ended up with same content | |
846 pass # don't get = keep local deleted | |
847 elif repo.ui.promptchoice( | |
842 _("remote changed %s which local deleted\n" | 848 _("remote changed %s which local deleted\n" |
843 "use (c)hanged version or leave (d)eleted?" | 849 "use (c)hanged version or leave (d)eleted?" |
844 "$$ &Changed $$ &Deleted") % f, 0) == 0: | 850 "$$ &Changed $$ &Deleted") % f, 0) == 0: |
845 actions['g'].append((f, (flags,), "prompt recreating")) | 851 actions['g'].append((f, (flags,), "prompt recreating")) |
846 del actions['dc'][:] | 852 del actions['dc'][:] |