##// END OF EJS Templates
mq: don't commit local changes on pushing empty patch (issue1087)
Dirkjan Ochtman -
r6554:3182602f default
parent child Browse files
Show More
@@ -509,7 +509,8 b' class queue:'
509 509 p1, p2 = repo.dirstate.parents()
510 510 repo.dirstate.setparents(p1, merge)
511 511 files = patch.updatedir(self.ui, repo, files)
512 n = repo.commit(files, message, user, date, force=1)
512 n = repo.commit(files, message, user, date, match=util.never,
513 force=True)
513 514
514 515 if n == None:
515 516 raise util.Abort(_("repo commit failed"))
@@ -497,3 +497,35 b' hg qnew -f -e changea'
497 497 hg qpop
498 498 hg qpush
499 499 cd ..
500
501 echo % test qpush with --force, issue1087
502 hg init forcepush
503 cd forcepush
504 echo hello > hello.txt
505 echo bye > bye.txt
506 hg ci -Ama
507 hg qnew -d '0 0' empty
508 hg qpop
509 echo world >> hello.txt
510
511 echo % qpush should fail, local changes
512 hg qpush
513
514 echo % apply force, should not discard changes with empty patch
515 hg qpush -f
516 hg diff --config diff.nodates=True
517 hg qdiff --config diff.nodates=True
518 hg log -l1 -p
519 hg qref -d '0 0'
520 hg qpop
521 echo universe >> hello.txt
522 echo universe >> bye.txt
523
524 echo % qpush should fail, local changes
525 hg qpush
526
527 echo % apply force, should discard changes in hello, but not bye
528 hg qpush -f
529 hg st
530 hg diff --config diff.nodates=True
531 hg qdiff --config diff.nodates=True
@@ -484,3 +484,63 b' adding a'
484 484 Patch queue now empty
485 485 applying changea
486 486 Now at: changea
487 % test qpush with --force, issue1087
488 adding bye.txt
489 adding hello.txt
490 Patch queue now empty
491 % qpush should fail, local changes
492 abort: local changes found, refresh first
493 % apply force, should not discard changes with empty patch
494 applying empty
495 /usr/bin/patch: **** Only garbage was found in the patch input.
496 patch failed, unable to continue (try -v)
497 patch empty is empty
498 Now at: empty
499 diff -r bf5fc3f07a0a hello.txt
500 --- a/hello.txt
501 +++ b/hello.txt
502 @@ -1,1 +1,2 @@
503 hello
504 +world
505 diff -r 9ecee4f634e3 hello.txt
506 --- a/hello.txt
507 +++ b/hello.txt
508 @@ -1,1 +1,2 @@
509 hello
510 +world
511 changeset: 1:bf5fc3f07a0a
512 tag: qtip
513 tag: tip
514 tag: empty
515 tag: qbase
516 user: test
517 date: Thu Jan 01 00:00:00 1970 +0000
518 summary: imported patch empty
519
520
521 Patch queue now empty
522 % qpush should fail, local changes
523 abort: local changes found, refresh first
524 % apply force, should discard changes in hello, but not bye
525 applying empty
526 Now at: empty
527 M bye.txt
528 diff -r ba252371dbc1 bye.txt
529 --- a/bye.txt
530 +++ b/bye.txt
531 @@ -1,1 +1,2 @@
532 bye
533 +universe
534 diff -r 9ecee4f634e3 bye.txt
535 --- a/bye.txt
536 +++ b/bye.txt
537 @@ -1,1 +1,2 @@
538 bye
539 +universe
540 diff -r 9ecee4f634e3 hello.txt
541 --- a/hello.txt
542 +++ b/hello.txt
543 @@ -1,1 +1,3 @@
544 hello
545 +world
546 +universe
General Comments 0
You need to be logged in to leave comments. Login now