diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -440,9 +440,9 @@ def overridecalculateupdates(origfn, rep for lfile in lfiles: standin = lfutil.standin(lfile) - lm = actionbyfile.get(lfile, (None, None, None))[0] - sm = actionbyfile.get(standin, (None, None, None))[0] - if sm == 'g' and lm != 'r': + (lm, largs, lmsg) = actionbyfile.get(lfile, (None, None, None)) + (sm, sargs, smsg) = actionbyfile.get(standin, (None, None, None)) + if sm in ('g', 'dc') and lm != 'r': # Case 1: normal file in the working copy, largefile in # the second parent usermsg = _('remote turned local normal file %s into a largefile\n' @@ -450,14 +450,16 @@ def overridecalculateupdates(origfn, rep '$$ &Largefile $$ &Normal file') % lfile if repo.ui.promptchoice(usermsg, 0) == 0: # pick remote largefile actionbyfile[lfile] = ('r', None, 'replaced by standin') + actionbyfile[standin] = ('g', sargs, 'replaces standin') else: # keep local normal file + actionbyfile[lfile] = ('k', None, 'replaces standin') if branchmerge: actionbyfile[standin] = ('k', None, 'replaced by non-standin') else: actionbyfile[standin] = ('r', None, 'replaced by non-standin') - elif lm == 'g' and sm != 'r': + elif lm in ('g', 'dc') and sm != 'r': # Case 2: largefile in the working copy, normal file in # the second parent usermsg = _('remote turned local largefile %s into a normal file\n' @@ -467,6 +469,7 @@ def overridecalculateupdates(origfn, rep if branchmerge: # largefile can be restored from standin safely actionbyfile[lfile] = ('k', None, 'replaced by standin') + actionbyfile[standin] = ('k', None, 'replaces standin') else: # "lfile" should be marked as "removed" without # removal of itself @@ -476,6 +479,7 @@ def overridecalculateupdates(origfn, rep # linear-merge should treat this largefile as 're-added' actionbyfile[standin] = ('a', None, 'keep standin') else: # pick remote normal file + actionbyfile[lfile] = ('g', largs, 'replaces standin') actionbyfile[standin] = ('r', None, 'replaced by non-standin') # Convert back to dictionary-of-lists format diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -640,26 +640,6 @@ def calculateupdates(repo, wctx, mctx, a _resolvetrivial(repo, wctx, mctx, ancestors[0], actions) - # Prompt and create actions. TODO: Move this towards resolve phase. - for f, args, msg in sorted(actions['cd']): - if repo.ui.promptchoice( - _("local changed %s which remote deleted\n" - "use (c)hanged version or (d)elete?" - "$$ &Changed $$ &Delete") % f, 0): - actions['r'].append((f, None, "prompt delete")) - else: - actions['a'].append((f, None, "prompt keep")) - del actions['cd'][:] - - for f, args, msg in sorted(actions['dc']): - flags, = args - if repo.ui.promptchoice( - _("remote changed %s which local deleted\n" - "use (c)hanged version or leave (d)eleted?" - "$$ &Changed $$ &Deleted") % f, 0) == 0: - actions['g'].append((f, (flags,), "prompt recreating")) - del actions['dc'][:] - if wctx.rev() is None: ractions, factions = _forgetremoved(wctx, mctx, branchmerge) actions['r'].extend(ractions) @@ -1111,6 +1091,26 @@ def update(repo, node, branchmerge, forc repo, wc, p2, pas, branchmerge, force, partial, mergeancestor, followcopies) + # Prompt and create actions. TODO: Move this towards resolve phase. + for f, args, msg in sorted(actions['cd']): + if repo.ui.promptchoice( + _("local changed %s which remote deleted\n" + "use (c)hanged version or (d)elete?" + "$$ &Changed $$ &Delete") % f, 0): + actions['r'].append((f, None, "prompt delete")) + else: + actions['a'].append((f, None, "prompt keep")) + del actions['cd'][:] + + for f, args, msg in sorted(actions['dc']): + flags, = args + if repo.ui.promptchoice( + _("remote changed %s which local deleted\n" + "use (c)hanged version or leave (d)eleted?" + "$$ &Changed $$ &Deleted") % f, 0) == 0: + actions['g'].append((f, (flags,), "prompt recreating")) + del actions['dc'][:] + ### apply phase if not branchmerge: # just jump to the new rev fp1, fp2, xp1, xp2 = fp2, nullid, xp2, '' diff --git a/tests/test-issue3084.t b/tests/test-issue3084.t --- a/tests/test-issue3084.t +++ b/tests/test-issue3084.t @@ -283,8 +283,6 @@ Ancestor: normal Parent: normal2 Paren $ hg up -Cqr normal2 $ hg merge -r large - local changed f which remote deleted - use (c)hanged version or (d)elete? c remote turned local normal file f into a largefile use (l)argefile or keep (n)ormal file? l getting changed largefiles @@ -295,9 +293,7 @@ Ancestor: normal Parent: normal2 Paren large $ hg up -Cqr normal2 - $ ( echo c; echo n ) | hg merge -r large --config ui.interactive=Yes - local changed f which remote deleted - use (c)hanged version or (d)elete? c + $ echo n | hg merge -r large --config ui.interactive=Yes remote turned local normal file f into a largefile use (l)argefile or keep (n)ormal file? n 0 files updated, 0 files merged, 0 files removed, 0 files unresolved @@ -305,23 +301,10 @@ Ancestor: normal Parent: normal2 Paren $ cat f normal2 - $ hg up -Cqr normal2 - $ echo d | hg merge -r large --config ui.interactive=Yes - local changed f which remote deleted - use (c)hanged version or (d)elete? d - getting changed largefiles - 1 largefiles updated, 0 removed - 1 files updated, 0 files merged, 1 files removed, 0 files unresolved - (branch merge, don't forget to commit) - $ cat f - large - swap $ hg up -Cqr large $ hg merge -r normal2 - remote changed f which local deleted - use (c)hanged version or leave (d)eleted? c remote turned local largefile f into a normal file keep (l)argefile or use (n)ormal file? l getting changed largefiles @@ -332,9 +315,7 @@ swap large $ hg up -Cqr large - $ ( echo c; echo n ) | hg merge -r normal2 --config ui.interactive=Yes - remote changed f which local deleted - use (c)hanged version or leave (d)eleted? c + $ echo n | hg merge -r normal2 --config ui.interactive=Yes remote turned local largefile f into a normal file keep (l)argefile or use (n)ormal file? n getting changed largefiles @@ -344,17 +325,6 @@ swap $ cat f normal2 - $ hg up -Cqr large - $ echo d | hg merge -r normal2 --config ui.interactive=Yes - remote changed f which local deleted - use (c)hanged version or leave (d)eleted? d - getting changed largefiles - 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 - Ancestor: large Parent: large-id Parent: normal result: normal $ hg up -Cqr large-id @@ -400,8 +370,6 @@ Ancestor: large Parent: large2 Paren $ hg up -Cqr large2 $ hg merge -r normal - local changed .hglf/f which remote deleted - use (c)hanged version or (d)elete? c remote turned local largefile f into a normal file keep (l)argefile or use (n)ormal file? l getting changed largefiles @@ -412,9 +380,9 @@ Ancestor: large Parent: large2 Paren large2 $ hg up -Cqr large2 - $ echo d | hg merge -r normal --config ui.interactive=Yes - local changed .hglf/f which remote deleted - use (c)hanged version or (d)elete? d + $ echo n | hg merge -r normal --config ui.interactive=Yes + remote turned local largefile f into a normal file + keep (l)argefile or use (n)ormal file? n getting changed largefiles 0 largefiles updated, 0 removed 1 files updated, 0 files merged, 1 files removed, 0 files unresolved @@ -426,8 +394,6 @@ swap $ hg up -Cqr normal $ hg merge -r large2 - remote changed .hglf/f which local deleted - use (c)hanged version or leave (d)eleted? c remote turned local normal file f into a largefile use (l)argefile or keep (n)ormal file? l getting changed largefiles @@ -438,9 +404,9 @@ swap large2 $ hg up -Cqr normal - $ echo d | hg merge -r large2 --config ui.interactive=Yes - remote changed .hglf/f which local deleted - use (c)hanged version or leave (d)eleted? d + $ echo n | hg merge -r large2 --config ui.interactive=Yes + remote turned local normal file f into a largefile + use (l)argefile or keep (n)ormal file? n 1 files updated, 0 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) $ cat f diff --git a/tests/test-largefiles-update.t b/tests/test-largefiles-update.t --- a/tests/test-largefiles-update.t +++ b/tests/test-largefiles-update.t @@ -320,8 +320,6 @@ Test a linear merge to a revision contai $ hg update -q -C 2 $ echo 'modified large2 for linear merge' > large2 $ hg update -q 5 - local changed .hglf/large2 which remote deleted - use (c)hanged version or (d)elete? c remote turned local largefile large2 into a normal file keep (l)argefile or use (n)ormal file? l $ hg debugdirstate --nodates | grep large2 @@ -368,8 +366,6 @@ Test that the internal linear merging wo adding manifests adding file changes added 3 changesets with 5 changes to 5 files - local changed .hglf/large2 which remote deleted - use (c)hanged version or (d)elete? c remote turned local largefile large2 into a normal file keep (l)argefile or use (n)ormal file? l largefile large1 has a merge conflict @@ -403,8 +399,6 @@ Test that the internal linear merging wo adding manifests adding file changes added 3 changesets with 5 changes to 5 files - local changed .hglf/large2 which remote deleted - use (c)hanged version or (d)elete? c remote turned local largefile large2 into a normal file keep (l)argefile or use (n)ormal file? l largefile large1 has a merge conflict @@ -451,7 +445,6 @@ Test that the internal linear merging wo $ hg update --config ui.interactive=True --config debug.dirstate.delaywrite=2 < m > r - > c > l > l > EOF @@ -459,8 +452,6 @@ Test that the internal linear merging wo (M)erge, keep (l)ocal or keep (r)emote? m subrepository sources for sub differ (in checked out version) use (l)ocal source (f74e50bd9e55) or (r)emote source (d65e59e952a9)? r - local changed .hglf/large2 which remote deleted - use (c)hanged version or (d)elete? c remote turned local largefile large2 into a normal file keep (l)argefile or use (n)ormal file? l largefile large1 has a merge conflict