summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2014-05-03 21:16:51 -0500
committerJunio C Hamano <gitster@pobox.com>2014-05-07 11:16:09 -0700
commit0bbe16f12905305180879346fee49c2f7efee9df (patch)
tree13c461e29176ce269b388959eca8eb284723fd58
parentb4f86a4ce85e4e370a67455de6586a02f158a789 (diff)
downloadgit-0bbe16f12905305180879346fee49c2f7efee9df.tar.gz
remote-hg: add more tests
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xcontrib/remote-helpers/test-hg.sh150
1 files changed, 150 insertions, 0 deletions
diff --git a/contrib/remote-helpers/test-hg.sh b/contrib/remote-helpers/test-hg.sh
index 7d90056cf3..a403c9ac7d 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