[PATCH] test-transplant.t: improve test coverage

timeless timeless at mozdev.org
Wed Jan 6 06:41:07 UTC 2016


# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1452062254 0
#      Wed Jan 06 06:37:34 2016 +0000
# Node ID 8dfce8bc54e26abd3e5bc7267b1a12bb18b91d78
# Parent  b8405d739149cdd6d8d9bd5e3dd2ad8487b1f09a
test-transplant.t: improve test coverage

* ?, x, q
* not a parent
* --source
* outstanding local changes
* outstanding uncommitted merges
* no revision checked out
* checkopts all+branch+rev
* checkopts all-branch
* checkopts no-args
* checkopts continue+all
* revset:transplanted(...)
* filter corrupted changeset

diff --git a/tests/test-transplant.t b/tests/test-transplant.t
--- a/tests/test-transplant.t
+++ b/tests/test-transplant.t
@@ -7,9 +7,26 @@
 
   $ hg init t
   $ cd t
+  $ hg transplant
+  abort: no source URL, branch revision, or revision list provided
+  [255]
+  $ hg transplant --continue --all
+  abort: --continue is incompatible with --branch, --all and --merge
+  [255]
+  $ hg transplant --all tip
+  abort: --all requires a branch revision
+  [255]
+  $ hg transplant --all --branch default tip
+  abort: --all is incompatible with a revision list
+  [255]
   $ echo r1 > r1
   $ hg ci -Amr1 -d'0 0'
   adding r1
+  $ hg co -q null
+  $ hg transplant tip
+  abort: no revision checked out
+  [255]
+  $ hg up -q
   $ echo r2 > r2
   $ hg ci -Amr2 -d'1 0'
   adding r2
@@ -20,6 +37,18 @@
   $ hg ci -Amb1 -d '0 0'
   adding b1
   created new head
+  $ hg merge 1
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg transplant 1
+  abort: outstanding uncommitted merges
+  [255]
+  $ hg up -qC tip
+  $ echo b0 > b1
+  $ hg transplant 1
+  abort: outstanding local changes
+  [255]
+  $ hg up -qC tip
   $ echo b2 > b2
   $ hg ci -Amb2 -d '1 0'
   adding b2
@@ -37,6 +66,9 @@
   $ hg clone . ../rebase
   updating to branch default
   4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg init ../emptydest
+  $ cd ../emptydest
+  $ hg transplant --source=../t > /dev/null
   $ cd ../rebase
 
   $ hg up -C 1
@@ -68,6 +100,8 @@
   5 1:d11e3596cc1a  b1
   6  b2
   7  b3
+  $ hg log -r 'transplanted(head())' --template '{rev} {parents} {desc}\n'
+  7  b3
   $ hg help revsets | grep transplanted
       "transplanted([set])"
         Transplanted changesets in set, or all transplanted changesets.
@@ -384,6 +418,18 @@
   patch failed to apply
   abort: fix up the merge and run hg transplant --continue
   [255]
+  $ cp .hg/transplant/journal .hg/transplant/journal.orig
+  $ cat .hg/transplant/journal
+  # User test
+  # Date 0 0
+  # Node ID 46ae92138f3ce0249f6789650403286ead052b6d
+  # Parent e8643552fde58f57515e19c4b373a57c96e62af3
+  foo2
+  $ grep -v 'Date' .hg/transplant/journal.orig > .hg/transplant/journal
+  $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg transplant --continue -e
+  abort: filter corrupted changeset (no user or date)
+  [255]
+  $ cp .hg/transplant/journal.orig .hg/transplant/journal
   $ HGEDITOR="sh $TESTTMP/checkeditform.sh" hg transplant --continue -e
   HGEDITFORM=transplant.normal
   46ae92138f3c transplanted as 9159dada197d
@@ -506,6 +552,23 @@
   o  0:17ab29e464c6
   
   $ hg transplant -q --config ui.interactive=true -s ../t <<EOF
+  > ?
+  > x
+  > q
+  > EOF
+  0:17ab29e464c6
+  apply changeset? [ynmpcq?]: ?
+  y: yes, transplant this changeset
+  n: no, skip this changeset
+  m: merge at this changeset
+  p: show patch
+  c: commit selected changesets
+  q: quit and cancel transplant
+  ?: ? (show this help)
+  apply changeset? [ynmpcq?]: x
+  unrecognized response
+  apply changeset? [ynmpcq?]: q
+  $ hg transplant -q --config ui.interactive=true -s ../t <<EOF
   > p
   > y
   > n
@@ -738,6 +801,9 @@
 
   $ hg init merge2b
   $ cd merge2b
+  $ hg transplant -s ../merge2a --parent tip tip
+  abort: be9f9b39483f is not a parent of be9f9b39483f
+  [255]
   $ hg transplant -s ../merge2a --parent 0 tip
   applying be9f9b39483f
   be9f9b39483f transplanted to 9959e51f94d1


More information about the Mercurial-devel mailing list