changeset 415:c2b9502a4e96

[PATCH] Don't prompt user for keep-vs-delete when the merge is about to be aborted -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 [PATCH] Don't prompt user for keep-vs-delete when the merge is about to be aborted From: Michael A Fetterman <Michael.Fetterman@cl.cam.ac.uk> If an "hg update" is attempted across branches, it is aborted with an error message, basically saying that "update -m" is required. Don't prompt the user for "keep vs delete" kinds of questions before deciding to abort. manifest hash: 250d3a0e866af2feac9344d499b26c254c33abc4 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) iD8DBQFCuNeDywK+sNU5EO8RAu2BAJwNWXXN2L+4TnOUGaOe9iBj6CgOYgCfRKIE RF5czx2UQ2pSIP119xzq9mQ= =Akj6 -----END PGP SIGNATURE-----
author mpm@selenic.com
date Tue, 21 Jun 2005 19:14:11 -0800
parents 291a62848f54
children 5e9e8b8d2629
files mercurial/hg.py tests/test-merge5 tests/test-merge5.out
diffstat 3 files changed, 49 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hg.py	Tue Jun 21 19:12:56 2005 -0800
+++ b/mercurial/hg.py	Tue Jun 21 19:14:11 2005 -0800
@@ -1092,9 +1092,11 @@
                 del m2[f]
             elif f in ma:
                 if not force and n != ma[f]:
-                    r = self.ui.prompt(
-                        (" local changed %s which remote deleted\n" % f) +
-                        "(k)eep or (d)elete?", "[kd]", "k")
+                    r = ""
+                    if linear_path or allow:
+                        r = self.ui.prompt(
+                            (" local changed %s which remote deleted\n" % f) +
+                            "(k)eep or (d)elete?", "[kd]", "k")
                     if r == "d":
                         remove.append(f)
                 else:
@@ -1113,9 +1115,11 @@
         for f, n in m2.iteritems():
             if f[0] == "/": continue
             if not force and f in ma and n != ma[f]:
-                r = self.ui.prompt(
-                    ("remote changed %s which local deleted\n" % f) +
-                    "(k)eep or (d)elete?", "[kd]", "k")
+                r = ""
+                if linear_path or allow:
+                    r = self.ui.prompt(
+                        ("remote changed %s which local deleted\n" % f) +
+                        "(k)eep or (d)elete?", "[kd]", "k")
                 if r == "d": remove.append(f)
             else:
                 self.ui.debug("remote created %s\n" % f)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-merge5	Tue Jun 21 19:14:11 2005 -0800
@@ -0,0 +1,21 @@
+#!/bin/sh -x
+
+mkdir t
+cd t
+hg init
+echo This is file a1 > a
+echo This is file b1 > b
+hg add a b
+hg commit -t "commit #0" -d "0 0" -u user
+echo This is file b22 > b
+hg commit -t"comment #1" -d "0 0" -u user
+hg update 0
+rm b
+hg commit -A -t"comment #2" -d "0 0" -u user
+# in theory, we shouldn't need the "yes k" below, but it prevents
+# this test from hanging when "hg update" erroneously prompts the
+# user for "keep or delete"
+yes k | hg update 1
+# we exit with 0 to avoid the unavoidable SIGPIPE from above causing
+# us to fail this test
+exit 0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-merge5.out	Tue Jun 21 19:14:11 2005 -0800
@@ -0,0 +1,18 @@
++ mkdir t
++ cd t
++ hg init
++ echo This is file a1
++ echo This is file b1
++ hg add a b
++ hg commit -t 'commit #0' -d '0 0' -u user
++ echo This is file b22
++ hg commit '-tcomment #1' -d '0 0' -u user
++ hg update 0
++ rm b
++ hg commit -A '-tcomment #2' -d '0 0' -u user
++ yes k
++ hg update 1
+this update spans a branch affecting the following files:
+aborting update spanning branches!
+(use update -m to perform a branch merge)
++ exit 0