changeset 18539:cf25e4efd685

merge: delay prompts a bit and show them in (extra) sorted order Preparing for backout of 760c0d67ce5e. The number of prompts will for all relevant cases be significantly smaller than the total number of files in the manifests. We can thus afford to sort the prompts more than we can afford to sort the manifests.
author Mads Kiilerich <madski@unity3d.com>
date Thu, 24 Jan 2013 23:57:44 +0100
parents 94317c2d53b8
children 139529b0a191
files mercurial/merge.py tests/test-rename-merge2.t
diffstat 2 files changed, 17 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Sat Feb 02 15:37:17 2013 -0200
+++ b/mercurial/merge.py	Thu Jan 24 23:57:44 2013 +0100
@@ -227,6 +227,7 @@
                 m1['.hgsubstate'] += "+"
                 break
 
+    prompts = []
     # Compare manifests
     visit = m1.iteritems()
     if repo.ui.debugflag:
@@ -265,13 +266,7 @@
             act("local copied/moved to " + f2, "m", f, f2, f, False)
         elif f in ma: # clean, a different, no remote
             if n != ma[f]:
-                if repo.ui.promptchoice(
-                    _(" local changed %s which remote deleted\n"
-                      "use (c)hanged version or (d)elete?") % f,
-                    (_("&Changed"), _("&Delete")), 0):
-                    act("prompt delete", "r", f)
-                else:
-                    act("prompt keep", "a", f)
+                prompts.append((f, "cd")) # prompt changed/deleted
             elif n[20:] == "a": # added, no remote
                 act("remote deleted", "f", f)
             else:
@@ -305,12 +300,24 @@
             else:
                 act("remote created", "g", f, m2.flags(f))
         elif n != ma[f]:
+            prompts.append((f, "dc")) # prompt deleted/changed
+
+    for f, m in sorted(prompts):
+        if m == "cd":
+            if repo.ui.promptchoice(
+                _(" local changed %s which remote deleted\n"
+                  "use (c)hanged version or (d)elete?") % f,
+                (_("&Changed"), _("&Delete")), 0):
+                act("prompt delete", "r", f)
+            else:
+                act("prompt keep", "a", f)
+        elif m == "dc":
             if repo.ui.promptchoice(
                 _("remote changed %s which local deleted\n"
                   "use (c)hanged version or leave (d)eleted?") % f,
                 (_("&Changed"), _("&Deleted")), 0) == 0:
                 act("prompt recreating", "g", f, m2.flags(f))
-
+        else: assert False, m
     return actions
 
 def actionkey(a):
--- a/tests/test-rename-merge2.t	Sat Feb 02 15:37:17 2013 -0200
+++ b/tests/test-rename-merge2.t	Thu Jan 24 23:57:44 2013 +0100
@@ -617,11 +617,11 @@
   resolving manifests
    overwrite: False, partial: False
    ancestor: 924404dff337, local: 0b76e65c8289+, remote: bdb19105162a
+   b: versions differ -> m
+   rev: versions differ -> m
    local changed a which remote deleted
   use (c)hanged version or (d)elete? c
    a: prompt keep -> a
-   b: versions differ -> m
-   rev: versions differ -> m
   preserving b for resolve of b
   preserving rev for resolve of rev
   updating: a 1/3 files (33.33%)