changeset 6558:550c53d66949

merge from crew-stable
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Wed, 16 Apr 2008 16:07:15 +0200
parents f2bd49752f0d (current diff) 3182602fa1fb (diff)
children 8b67211d9140
files hgext/mq.py tests/test-mq tests/test-mq.out
diffstat 3 files changed, 94 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Wed Apr 16 12:15:43 2008 +0200
+++ b/hgext/mq.py	Wed Apr 16 16:07:15 2008 +0200
@@ -509,7 +509,8 @@
                 p1, p2 = repo.dirstate.parents()
                 repo.dirstate.setparents(p1, merge)
             files = patch.updatedir(self.ui, repo, files)
-            n = repo.commit(files, message, user, date, force=1)
+            n = repo.commit(files, message, user, date, match=util.never,
+                            force=True)
 
             if n == None:
                 raise util.Abort(_("repo commit failed"))
--- a/tests/test-mq	Wed Apr 16 12:15:43 2008 +0200
+++ b/tests/test-mq	Wed Apr 16 16:07:15 2008 +0200
@@ -505,3 +505,35 @@
 hg qpop
 hg qpush
 cd ..
+
+echo % test qpush with --force, issue1087
+hg init forcepush
+cd forcepush
+echo hello > hello.txt
+echo bye > bye.txt
+hg ci -Ama
+hg qnew -d '0 0' empty
+hg qpop
+echo world >> hello.txt
+
+echo % qpush should fail, local changes
+hg qpush
+
+echo % apply force, should not discard changes with empty patch
+hg qpush -f
+hg diff --config diff.nodates=True
+hg qdiff --config diff.nodates=True
+hg log -l1 -p
+hg qref -d '0 0'
+hg qpop
+echo universe >> hello.txt
+echo universe >> bye.txt
+
+echo % qpush should fail, local changes
+hg qpush
+
+echo % apply force, should discard changes in hello, but not bye
+hg qpush -f
+hg st
+hg diff --config diff.nodates=True
+hg qdiff --config diff.nodates=True
--- a/tests/test-mq.out	Wed Apr 16 12:15:43 2008 +0200
+++ b/tests/test-mq.out	Wed Apr 16 16:07:15 2008 +0200
@@ -490,3 +490,63 @@
 Patch queue now empty
 applying changea
 Now at: changea
+% test qpush with --force, issue1087
+adding bye.txt
+adding hello.txt
+Patch queue now empty
+% qpush should fail, local changes
+abort: local changes found, refresh first
+% apply force, should not discard changes with empty patch
+applying empty
+/usr/bin/patch: **** Only garbage was found in the patch input.
+patch failed, unable to continue (try -v)
+patch empty is empty
+Now at: empty
+diff -r bf5fc3f07a0a hello.txt
+--- a/hello.txt
++++ b/hello.txt
+@@ -1,1 +1,2 @@
+ hello
++world
+diff -r 9ecee4f634e3 hello.txt
+--- a/hello.txt
++++ b/hello.txt
+@@ -1,1 +1,2 @@
+ hello
++world
+changeset:   1:bf5fc3f07a0a
+tag:         qtip
+tag:         tip
+tag:         empty
+tag:         qbase
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     imported patch empty
+
+
+Patch queue now empty
+% qpush should fail, local changes
+abort: local changes found, refresh first
+% apply force, should discard changes in hello, but not bye
+applying empty
+Now at: empty
+M bye.txt
+diff -r ba252371dbc1 bye.txt
+--- a/bye.txt
++++ b/bye.txt
+@@ -1,1 +1,2 @@
+ bye
++universe
+diff -r 9ecee4f634e3 bye.txt
+--- a/bye.txt
++++ b/bye.txt
+@@ -1,1 +1,2 @@
+ bye
++universe
+diff -r 9ecee4f634e3 hello.txt
+--- a/hello.txt
++++ b/hello.txt
+@@ -1,1 +1,3 @@
+ hello
++world
++universe