diff tests/test-mq-qpush-fail.t @ 16634:435375cc0ca0 stable

mq: backup local changes in qpush --force qpush help says the following about --force: 1- When -f/--force is applied, all local changes in patched files will be lost. 2- Apply on top of local changes In practice, qpush --force will attempt to apply the patch on top of local changes, and on success will merge them in the pushed patch. On failure, patched files will contain a mix of local changes (where the patch could not apply) and a mix of patch changes (were it applied). So, local changes are less lost than entangled with a mass of other changes. This patch makes qpush --force backup all locally modified files touched by the next patch being applied. When multiple patches are being pushed, this logic is repeated for each patch. Note that modified but successfully patched files are preserved as well.
author Patrick Mezard <patrick@mezard.eu>
date Fri, 11 May 2012 16:18:47 +0200
parents b2ca2f40c9c1
children 9d76320d8b99
line wrap: on
line diff
--- a/tests/test-mq-qpush-fail.t	Fri May 11 16:17:02 2012 +0200
+++ b/tests/test-mq-qpush-fail.t	Fri May 11 16:18:47 2012 +0200
@@ -188,3 +188,52 @@
   bb
   $ cat c.orig
   cc
+
+test qpush --force and backup files
+
+  $ echo a >> a
+  $ hg qnew p2
+  $ echo b >> b
+  $ echo d > d
+  $ echo e > e
+  $ hg add d e
+  $ hg rm c
+  $ hg qnew p3
+  $ hg qpop -a
+  popping p3
+  popping p2
+  patch queue now empty
+  $ echo a >> a
+  $ echo b1 >> b
+  $ echo d1 > d
+  $ hg add d
+  $ echo e1 > e
+  $ hg qpush -a --force --verbose
+  applying p2
+  saving current version of a as a.orig
+  patching file a
+  a
+  applying p3
+  saving current version of b as b.orig
+  saving current version of d as d.orig
+  patching file b
+  patching file c
+  patching file d
+  file d already exists
+  1 out of 1 hunks FAILED -- saving rejects to file d.rej
+  patching file e
+  file e already exists
+  1 out of 1 hunks FAILED -- saving rejects to file e.rej
+  patch failed to apply
+  b
+  patch failed, rejects left in working dir
+  errors during apply, please fix and refresh p3
+  [2]
+  $ cat a.orig
+  a
+  a
+  $ cat b.orig
+  b
+  b1
+  $ cat d.orig
+  d1