git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Chris Packham <judge.packham@gmail.com>
Date
Sep 5, 2014, 10:06 UTC
Message-ID
<1409911611-20370-4-git-send-email-judge.packham@gmail.com>
In-Reply-To
<1409911611-20370-1-git-send-email-judge.packham@gmail.com>

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@gmail.com>
Signed-off-by: Chris Packham <judge.packham@gmail.com>
---
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@example.com" &&
-- 
2.1.0.64.gc343089
Previous: Chris PackhamNext: Chris Packham
Message 12 of 13 in “[RFC PATCHv3 0/4] am: patch-format”
  1. Chris PackhamSep 5, 2014
  2. 1/4 am: avoid re-directing stdin twiceChris Packham, Sep 5, 2014
  3. Johannes SixtSep 5, 2014
  4. Chris PackhamSep 5, 2014
  5. Junio C HamanoSep 5, 2014
  6. Junio C HamanoSep 5, 2014
  7. Junio C HamanoSep 5, 2014
  8. Stephen BoydSep 5, 2014
  9. Junio C HamanoSep 6, 2014
  10. Torsten BögershausenSep 6, 2014
  11. 2/4 t/am: add test for stgit patch formatChris Packham, Sep 5, 2014
  12. 3/4 t/am: add tests for hg patch formatChris Packham, Sep 5, 2014
  13. 4/4 am: add gitk patch formatChris Packham, Sep 5, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.