Mercurial > hg > hg-git
changeset 506:98eb1c31e21b
tests: unify test-hg-tags
author | David M. Carr <david@carrclan.us> |
---|---|
date | Mon, 10 Sep 2012 00:27:30 -0400 (2012-09-10) |
parents | 140253b31ba9 |
children | 61927d60c543 |
files | tests/test-conflict-1.t tests/test-conflict-2.t tests/test-convergedmerge.t tests/test-empty-working-tree.t tests/test-file-removal.t tests/test-git-clone.t tests/test-git-submodules.t tests/test-git-tags.t tests/test-git-workflow.t tests/test-help.t tests/test-hg-author.t tests/test-hg-branch.t tests/test-hg-tags tests/test-hg-tags.out tests/test-hg-tags.t tests/test-keywords.t |
diffstat | 2 files changed, 116 insertions(+), 118 deletions(-) [+] |
line wrap: on
line diff
deleted file mode 100644 --- a/tests/test-hg-tags.out +++ /dev/null @@ -1,45 +0,0 @@ -Initialized empty Git repository in gitrepo/.git/ - -Switched to a new branch 'not-master' -importing git objects into hg -1 files updated, 0 files merged, 0 files removed, 0 files unresolved -0 files updated, 0 files merged, 0 files removed, 0 files unresolved -pushing to git://localhost/gitrepo -exporting hg objects to git -creating and sending data - default::refs/tags/alpha => GIT:7eeab2ea - default::refs/heads/master => GIT:9a2616b9 -@ changeset: 1:d529e9229f6d -| tag: default/master -| tag: tip -| user: test -| date: Mon Jan 01 00:00:11 2007 +0000 -| summary: Added tag alpha for changeset 3442585be8a6 -| -o changeset: 0:3442585be8a6 - tag: alpha - tag: default/not-master - user: test <test@example.org> - date: Mon Jan 01 00:00:10 2007 +0000 - summary: add alpha - -% git should have the tag alpha -alpha -importing git objects into hg -2 files updated, 0 files merged, 0 files removed, 0 files unresolved -@ changeset: 1:d529e9229f6d -| tag: default/master -| tag: tip -| user: test -| date: Mon Jan 01 00:00:11 2007 +0000 -| summary: Added tag alpha for changeset 3442585be8a6 -| -o changeset: 0:3442585be8a6 - tag: alpha - tag: default/not-master - user: test <test@example.org> - date: Mon Jan 01 00:00:10 2007 +0000 - summary: add alpha - -% the tag should be in .hgtags -3442585be8a60c6cd476bbc4e45755339f2a23ef alpha
rename from tests/test-hg-tags rename to tests/test-hg-tags.t --- a/tests/test-hg-tags +++ b/tests/test-hg-tags.t @@ -1,85 +1,128 @@ -#!/bin/sh +# Fails for some reason, need to investigate +# $ "$TESTDIR/hghave" git || exit 80 -# Fails for some reason, need to investigate -# "$TESTDIR/hghave" git || exit 80 +bail if the user does not have dulwich + $ python -c 'import dulwich, dulwich.repo' || exit 80 + +bail early if the user is already running git-daemon + $ ! (echo hi | nc localhost 9418 2>/dev/null) || exit 80 -# bail if the user does not have dulwich -python -c 'import dulwich, dulwich.repo' || exit 80 + $ echo "[extensions]" >> $HGRCPATH + $ echo "hggit=$(echo $(dirname $TESTDIR))/hggit" >> $HGRCPATH + $ echo 'hgext.graphlog =' >> $HGRCPATH + $ echo 'hgext.bookmarks =' >> $HGRCPATH -# bail early if the user is already running git-daemon -echo hi | nc localhost 9418 2>/dev/null && exit 80 + $ cat >> $HGRCPATH <<EOF + > + > [bookmarks] + > track.current = True + > EOF + + $ GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME + $ GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL + $ GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE + $ GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME + $ GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL + $ GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE -echo "[extensions]" >> $HGRCPATH -echo "hggit=$(echo $(dirname $(dirname $0)))/hggit" >> $HGRCPATH -echo 'hgext.graphlog =' >> $HGRCPATH -echo 'hgext.bookmarks =' >> $HGRCPATH - -cat >> $HGRCPATH <<EOF + $ count=10 + $ commit() + > { + > GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000" + > GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" + > git commit "$@" >/dev/null 2>/dev/null || echo "git commit error" + > count=`expr $count + 1` + > } + $ hgtag() + > { + > HGDATE="2007-01-01 00:00:$count +0000" + > hg tag -d "$HGDATE" "$@" >/dev/null 2>/dev/null || echo "hg commit error" + > count=`expr $count + 1` + > } -[bookmarks] -track.current = True -EOF + $ mkdir gitrepo + $ cd gitrepo + $ git init | python -c "import sys; print sys.stdin.read().replace('$(dirname $(pwd))/', '')" + Initialized empty Git repository in gitrepo/.git/ + -GIT_AUTHOR_NAME='test'; export GIT_AUTHOR_NAME -GIT_AUTHOR_EMAIL='test@example.org'; export GIT_AUTHOR_EMAIL -GIT_AUTHOR_DATE="2007-01-01 00:00:00 +0000"; export GIT_AUTHOR_DATE -GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"; export GIT_COMMITTER_NAME -GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"; export GIT_COMMITTER_EMAIL -GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"; export GIT_COMMITTER_DATE + $ echo alpha > alpha + $ git add alpha + $ commit -m "add alpha" + $ git checkout -b not-master + Switched to a new branch 'not-master' + +dulwich does not presently support local git repos, workaround + $ cd .. + $ git daemon --base-path="$(pwd)"\ + > --listen=localhost\ + > --export-all\ + > --pid-file="$DAEMON_PIDS" \ + > --detach --reuseaddr \ + > --enable=receive-pack -count=10 -commit() -{ - GIT_AUTHOR_DATE="2007-01-01 00:00:$count +0000" - GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" - git commit "$@" >/dev/null 2>/dev/null || echo "git commit error" - count=`expr $count + 1` -} -hgtag() -{ - HGDATE="2007-01-01 00:00:$count +0000" - hg tag -d "$HGDATE" "$@" >/dev/null 2>/dev/null || echo "hg commit error" - count=`expr $count + 1` -} + $ hg clone git://localhost/gitrepo hgrepo | grep -v '^updating' + importing git objects into hg + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + + $ cd hgrepo + $ hg co master + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hgtag alpha + $ hg push + pushing to git://localhost/gitrepo + exporting hg objects to git + creating and sending data + default::refs/tags/alpha => GIT:7eeab2ea + default::refs/heads/master => GIT:9a2616b9 -mkdir gitrepo -cd gitrepo -git init | python -c "import sys; print sys.stdin.read().replace('$(dirname $(pwd))/', '')" - -echo alpha > alpha -git add alpha -commit -m "add alpha" -git checkout -b not-master + $ hg log --graph | egrep -v ': *(not-master|master)' + @ changeset: 1:d529e9229f6d + | tag: default/master + | tag: tip + | user: test + | date: Mon Jan 01 00:00:11 2007 +0000 + | summary: Added tag alpha for changeset 3442585be8a6 + | + o changeset: 0:3442585be8a6 + tag: alpha + tag: default/not-master + user: test <test@example.org> + date: Mon Jan 01 00:00:10 2007 +0000 + summary: add alpha + -# dulwich does not presently support local git repos, workaround -cd .. -git daemon --base-path="$(pwd)"\ - --listen=localhost\ - --export-all\ - --pid-file="$DAEMON_PIDS" \ - --detach --reuseaddr \ - --enable=receive-pack - -hg clone git://localhost/gitrepo hgrepo | grep -v '^updating' - -cd hgrepo -hg co master -hgtag alpha -hg push + $ cd .. + $ cd gitrepo + $ echo % git should have the tag alpha + % git should have the tag alpha + $ git tag -l + alpha -hg log --graph | egrep -v ': *(not-master|master)' - -cd .. -cd gitrepo -echo % git should have the tag alpha -git tag -l + $ cd .. + $ hg clone git://localhost/gitrepo hgrepo2 | grep -v '^updating' + importing git objects into hg + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ cd hgrepo2 + $ hg log --graph | egrep -v ': *(not-master|master)' + @ changeset: 1:d529e9229f6d + | tag: default/master + | tag: tip + | user: test + | date: Mon Jan 01 00:00:11 2007 +0000 + | summary: Added tag alpha for changeset 3442585be8a6 + | + o changeset: 0:3442585be8a6 + tag: alpha + tag: default/not-master + user: test <test@example.org> + date: Mon Jan 01 00:00:10 2007 +0000 + summary: add alpha + -cd .. -hg clone git://localhost/gitrepo hgrepo2 | grep -v '^updating' -cd hgrepo2 -hg log --graph | egrep -v ': *(not-master|master)' + $ echo % the tag should be in .hgtags + % the tag should be in .hgtags + $ cat .hgtags + 3442585be8a60c6cd476bbc4e45755339f2a23ef alpha -echo % the tag should be in .hgtags -cat .hgtags - -cd .. + $ cd ..