[RFC PATCHv3 3/4] t/am: add tests for hg patch format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This adds a tests which exercise the detection of the hg format.  As
with stgit there is a current know breakage in where split_patches can't
handle reading from stdin with these patch formats.

Cc: Giuseppe Bilotta <giuseppe.bilotta@xxxxxxxxx>
Signed-off-by: Chris Packham <judge.packham@xxxxxxxxx>
---
Note. I don't have access to a mercurial repository (plus I know next to
nothing about it) so the patch I've generated for the test was created
by looking at the format detection code. If someone can show me an
actual example of what mercurial produces that'd be helpful.

 t/t4150-am.sh | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/t/t4150-am.sh b/t/t4150-am.sh
index dbe3475..8ee81cf 100755
--- a/t/t4150-am.sh
+++ b/t/t4150-am.sh
@@ -112,6 +112,14 @@ test_expect_success setup '
 		echo "---" &&
 		git diff-tree --stat -p second | sed -e "1d"
 	} > patch1-stgit.eml &&
+	{
+		echo "# HG changeset patch"
+		echo "# User $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>"
+		echo &&
+		cat msg &&
+		echo "---" &&
+		git diff-tree --stat -p second | sed -e "1d"
+	} > patch1-hg.eml &&
 
 	sed -n -e "3,\$p" msg >file &&
 	git add file &&
@@ -213,6 +221,24 @@ test_expect_failure 'am applies patch using --patch-format=stgit' '
 	git diff --exit-code second
 '
 
+test_expect_success 'am applies patch generated by hg' '
+	rm -fr .git/rebase-apply &&
+	git reset --hard &&
+	git checkout first &&
+	git am patch1-hg.eml &&
+	test_path_is_missing .git/rebase-apply &&
+	git diff --exit-code second
+'
+
+test_expect_failure 'am applies patch using --patch-format=hg' '
+	rm -fr .git/rebase-apply &&
+	git reset --hard &&
+	git checkout first &&
+	git am --patch-format=hg <patch1-hg.eml &&
+	test_path_is_missing .git/rebase-apply &&
+	git diff --exit-code second
+'
+
 test_expect_success 'setup: new author and committer' '
 	GIT_AUTHOR_NAME="Another Thor" &&
 	GIT_AUTHOR_EMAIL="a.thor@xxxxxxxxxxx" &&
-- 
2.1.0.64.gc343089

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]