Patchwork [04,of,16] merge: handle acceptremove of create+delete early in manifest merge

login
register
mail settings
Submitter Mads Kiilerich
Date March 2, 2014, 7:15 p.m.
Message ID <d7e945aaee13e23271ad.1393787737@localhost.localdomain>
Download mbox | patch
Permalink /patch/3816/
State Accepted
Commit 1df033640a8e540538cbefde5b5ebb7a892976ab
Headers show

Comments

Mads Kiilerich - March 2, 2014, 7:15 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1393550763 -3600
#      Fri Feb 28 02:26:03 2014 +0100
# Node ID d7e945aaee13e23271ade550856293c2a61d22f7
# Parent  e265102a5342cc09743238aac2283d97c271a0b1
merge: handle acceptremove of create+delete early in manifest merge

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -423,7 +423,10 @@  def manifestmerge(repo, wctx, p2, pa, br
                             "local copied/moved to " + f2))
         elif n1 and f in ma: # clean, a different, no remote
             if n1 != ma[f]:
-                prompts.append((f, "cd")) # prompt changed/deleted
+                if acceptremote:
+                    actions.append((f, "r", None, "remote delete"))
+                else:
+                    prompts.append((f, "cd")) # prompt changed/deleted
             elif n1[20:] == "a": # added, no remote
                 actions.append((f, "f", None, "remote deleted"))
             else:
@@ -470,7 +473,11 @@  def manifestmerge(repo, wctx, p2, pa, br
                 aborts.append((f, "ud"))
             else:
                 # if different: old untracked f may be overwritten and lost
-                prompts.append((f, "dc")) # prompt deleted/changed
+                if acceptremote:
+                    actions.append((f, "g", (m2.flags(f),),
+                                   "remote recreating"))
+                else:
+                    prompts.append((f, "dc")) # prompt deleted/changed
 
     for f, m in sorted(aborts):
         if m == "ud":
@@ -490,9 +497,7 @@  def manifestmerge(repo, wctx, p2, pa, br
 
     for f, m in sorted(prompts):
         if m == "cd":
-            if acceptremote:
-                actions.append((f, "r", None, "remote delete"))
-            elif repo.ui.promptchoice(
+            if repo.ui.promptchoice(
                 _("local changed %s which remote deleted\n"
                   "use (c)hanged version or (d)elete?"
                   "$$ &Changed $$ &Delete") % f, 0):
@@ -500,9 +505,7 @@  def manifestmerge(repo, wctx, p2, pa, br
             else:
                 actions.append((f, "a", None, "prompt keep"))
         elif m == "dc":
-            if acceptremote:
-                actions.append((f, "g", (m2.flags(f),), "remote recreating"))
-            elif repo.ui.promptchoice(
+            if repo.ui.promptchoice(
                 _("remote changed %s which local deleted\n"
                   "use (c)hanged version or leave (d)eleted?"
                   "$$ &Changed $$ &Deleted") % f, 0) == 0: