git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Chris Packham <judge.packham@gmail.com>
To: git@vger.kernel.org
Cc: Chris Packham <judge.packham@gmail.com>,
	Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Subject: [RFC PATCHv3 3/4] t/am: add tests for hg patch format
Date: Fri,  5 Sep 2014 22:06:50 +1200	[thread overview]
Message-ID: <1409911611-20370-4-git-send-email-judge.packham@gmail.com> (raw)
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

  parent reply	other threads:[~2014-09-05 10:07 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-05 10:06 [RFC PATCHv3 0/4] am: patch-format Chris Packham
2014-09-05 10:06 ` [RFC PATCHv3 1/4] am: avoid re-directing stdin twice Chris Packham
2014-09-05 20:26   ` Johannes Sixt
2014-09-05 21:31     ` Chris Packham
2014-09-05 22:00       ` Junio C Hamano
2014-09-05 22:16         ` Junio C Hamano
2014-09-05 22:25           ` Junio C Hamano
2014-09-05 23:18             ` Stephen Boyd
2014-09-06  7:34               ` Junio C Hamano
2014-09-06 12:46                 ` Torsten Bögershausen
2014-09-05 10:06 ` [RFC PATCHv3 2/4] t/am: add test for stgit patch format Chris Packham
2014-09-05 10:06 ` Chris Packham [this message]
2014-09-05 10:06 ` [RFC PATCHv3 4/4] am: add gitk " Chris Packham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1409911611-20370-4-git-send-email-judge.packham@gmail.com \
    --to=judge.packham@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=giuseppe.bilotta@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).