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

[PATCH 1/4] remote-hg: add more tests

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
May 4, 2014, 02:16 UTC
Message-ID
<1399169814-20201-2-git-send-email-felipe.contreras@gmail.com>
In-Reply-To
<1399169814-20201-1-git-send-email-felipe.contreras@gmail.com>
Inspired by the tests in gitifyhg.

One test is failing, but that's because of a limitation of remote-helpers.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 contrib/remote-helpers/test-hg.sh | 150 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 150 insertions(+)
diff --git a/contrib/remote-helpers/test-hg.sh b/contrib/remote-helpers/test-hg.sh
index 7d90056..33a434d 100755
--- a/contrib/remote-helpers/test-hg.sh
+++ b/contrib/remote-helpers/test-hg.sh
@@ -845,4 +845,154 @@ test_expect_success 'clone remote with generic null bookmark, then push to the b
 	)
 '
 
+test_expect_success 'notes' '
+	test_when_finished "rm -rf hgrepo gitrepo" &&
+
+	(
+	hg init hgrepo &&
+	cd hgrepo &&
+	echo one > content &&
+	hg add content &&
+	hg commit -m one &&
+	echo two > content &&
+	hg commit -m two
+	) &&
+
+	git clone "hg::hgrepo" gitrepo &&
+	hg -R hgrepo log --template "{node}\n\n" > expected &&
+	git --git-dir=gitrepo/.git log --pretty="tformat:%N" --notes=hg > actual &&
+	test_cmp expected actual
+'
+
+test_expect_failure 'push updates notes' '
+	test_when_finished "rm -rf hgrepo gitrepo" &&
+
+	(
+	hg init hgrepo &&
+	cd hgrepo &&
+	echo one > content &&
+	hg add content &&
+	hg commit -m one
+	) &&
+
+	git clone "hg::hgrepo" gitrepo &&
+
+	(
+	cd gitrepo &&
+	echo two > content &&
+	git commit -a -m two
+	git push
+	) &&
+
+	hg -R hgrepo log --template "{node}\n\n" > expected &&
+	git --git-dir=gitrepo/.git log --pretty="tformat:%N" --notes=hg > actual &&
+	test_cmp expected actual
+'
+
+test_expect_success 'pull tags' '
+	test_when_finished "rm -rf hgrepo gitrepo" &&
+
+	(
+	hg init hgrepo &&
+	cd hgrepo &&
+	echo one > content &&
+	hg add content &&
+	hg commit -m one
+	) &&
+
+	git clone "hg::hgrepo" gitrepo &&
+
+	(cd hgrepo && hg tag v1.0) &&
+	(cd gitrepo && git pull) &&
+
+	echo "v1.0" > expected &&
+	git --git-dir=gitrepo/.git tag > actual &&
+	test_cmp expected actual
+'
+
+test_expect_success 'push merged named branch' '
+	test_when_finished "rm -rf hgrepo gitrepo" &&
+
+	(
+	hg init hgrepo &&
+	cd hgrepo &&
+	echo one > content &&
+	hg add content &&
+	hg commit -m one &&
+	hg branch feature &&
+	echo two > content &&
+	hg commit -m two &&
+	hg update default &&
+	echo three > content &&
+	hg commit -m three
+	) &&
+
+	(
+	git clone "hg::hgrepo" gitrepo &&
+	cd gitrepo &&
+	git merge -m Merge -Xtheirs origin/branches/feature &&
+	git push
+	) &&
+
+	cat > expected <<-EOF
+	Merge
+	three
+	two
+	one
+	EOF
+	hg -R hgrepo log --template "{desc}\n" > actual &&
+	test_cmp expected actual
+'
+
+test_expect_success 'light tag sets author' '
+	test_when_finished "rm -rf hgrepo gitrepo" &&
+
+	(
+	hg init hgrepo &&
+	cd hgrepo &&
+	echo one > content &&
+	hg add content &&
+	hg commit -m one
+	) &&
+
+	(
+	git clone "hg::hgrepo" gitrepo &&
+	cd gitrepo &&
+	git tag v1.0 &&
+	git push --tags
+	) &&
+
+	echo "C O Mitter <committer@example.com>" > expected &&
+	hg -R hgrepo log --template "{author}\n" -r tip > actual &&
+	test_cmp expected actual
+'
+
+test_expect_success 'push tag different branch' '
+	test_when_finished "rm -rf hgrepo gitrepo" &&
+
+	(
+	hg init hgrepo &&
+	cd hgrepo &&
+	echo one > content &&
+	hg add content &&
+	hg commit -m one
+	hg branch feature &&
+	echo two > content &&
+	hg commit -m two
+	) &&
+
+	(
+	git clone "hg::hgrepo" gitrepo &&
+	cd gitrepo &&
+	git branch &&
+	git checkout branches/feature &&
+	git tag v1.0 &&
+	git push --tags
+	) &&
+
+	echo feature > expected &&
+	hg -R hgrepo log --template="{branch}\n" -r tip > actual &&
+	test_cmp expected actual
+'
+
 test_done
-- 
1.9.2+fc1.20.g204a630
Previous: Felipe ContrerasNext: Eric Sunshine
Message 2 of 49 in “remote-hg: more improvements”
  1. 0/4 remote-hg: more improvementsFelipe Contreras, May 4, 2014
  2. 1/4 remote-hg: add more testsFelipe Contreras, May 4, 2014
  3. Eric SunshineMay 4, 2014
  4. 2/4 t: remote-hg: add file operation testsFelipe Contreras, May 4, 2014
  5. 3/4 t: remote-hg: trivial cleanups and fixesFelipe Contreras, May 4, 2014
  6. 4/4 remote-hg: add support for hg v3.0Felipe Contreras, May 4, 2014
  7. Junio C HamanoMay 7, 2014
  8. Felipe ContrerasMay 7, 2014
  9. Junio C HamanoMay 7, 2014
  10. Felipe ContrerasMay 7, 2014
  11. Junio C HamanoMay 7, 2014
  12. Felipe ContrerasMay 8, 2014
  13. James DenholmMay 8, 2014
  14. Felipe ContrerasMay 8, 2014
  15. Philippe VaucherMay 11, 2014
  16. Philippe VaucherMay 12, 2014
  17. Junio C HamanoMay 12, 2014
  18. Felipe ContrerasMay 12, 2014
  19. Junio C HamanoMay 12, 2014
  20. Felipe ContrerasMay 12, 2014
  21. Philippe VaucherMay 14, 2014
  22. David KastrupMay 14, 2014
  23. Philippe VaucherMay 14, 2014
  24. David KastrupMay 14, 2014
  25. Philippe VaucherMay 14, 2014
  26. David KastrupMay 14, 2014
  27. Philippe VaucherMay 14, 2014
  28. David KastrupMay 14, 2014
  29. Philippe VaucherMay 14, 2014
  30. Felipe ContrerasMay 14, 2014
  31. David KastrupMay 14, 2014
  32. Felipe ContrerasMay 14, 2014
  33. David KastrupMay 14, 2014
  34. Felipe ContrerasMay 14, 2014
  35. David KastrupMay 15, 2014
  36. Junio C HamanoMay 14, 2014
  37. David KastrupMay 14, 2014
  38. Junio C HamanoMay 14, 2014
  39. Junio C HamanoMay 8, 2014
  40. Felipe ContrerasMay 8, 2014
  41. Junio C HamanoMay 8, 2014
  42. Felipe ContrerasMay 8, 2014
  43. Junio C HamanoMay 8, 2014
  44. Felipe ContrerasMay 8, 2014
  45. Junio C HamanoMay 8, 2014
  46. Felipe ContrerasMay 8, 2014
  47. Felipe ContrerasMay 9, 2014
  48. Junio C HamanoMay 9, 2014
  49. Felipe ContrerasMay 9, 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.