changeset 199:4a480133b29a

add test for octopus merge conversion
author Abderrahim Kitouni <a.kitouni@gmail.com>
date Thu, 25 Jun 2009 16:24:36 +0100
parents 4edf3e1e8197
children dfed3bd84184
files git_handler.py tests/test-octopus tests/test-octopus.out
diffstat 3 files changed, 134 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/git_handler.py	Wed Jun 24 15:18:42 2009 +0100
+++ b/git_handler.py	Thu Jun 25 16:24:36 2009 +0100
@@ -243,7 +243,7 @@
                 timezone = format_timezone(-int(timezone))
                 commit['committer'] = '%s %s' % (name_timestamp, timezone)
             except ValueError:
-                self.ui.warn(_("Ignoring committer in extra, invalid timezone in r%s: '%s'.\n") % (rev, timezone))
+                self.ui.warn(_("Ignoring committer in extra, invalid timezone in r%d: '%s'.\n") % (ctx, timezone))
         if 'encoding' in extra:
             commit['encoding'] = extra['encoding']
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-octopus	Thu Jun 25 16:24:36 2009 +0100
@@ -0,0 +1,68 @@
+#!/bin/sh
+
+# Fails for some reason, need to investigate
+# "$TESTDIR/hghave" git || exit 80
+
+# bail early if the user is already running git-daemon
+echo hi | nc localhost 9418 2>/dev/null && exit 80
+
+echo "[extensions]" >> $HGRCPATH
+echo "hggit=$(echo $(dirname $(dirname $0)))" >> $HGRCPATH
+echo 'hgext.graphlog =' >> $HGRCPATH
+echo 'hgext.bookmarks =' >> $HGRCPATH
+
+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
+
+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`
+}
+
+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 branch1
+echo beta > beta
+git add beta
+commit -m 'add beta'
+
+git checkout -b branch2 master
+echo gamma > gamma
+git add gamma
+commit -m 'add gamma'
+
+git checkout master
+echo delta > delta
+git add delta
+commit -m 'add delta'
+
+git merge branch1 branch2
+
+# dulwich does not presently support local git repos, workaround
+cd ..
+git daemon --base-path="$(pwd)"\
+ --listen=localhost\
+ --export-all\
+  --pid-file=gitdaemon.pid \
+ --detach --reuseaddr
+
+hg clone git://localhost/gitrepo hgrepo
+cd hgrepo
+hg log --graph
+
+cd ..
+kill `cat gitdaemon.pid`
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-octopus.out	Thu Jun 25 16:24:36 2009 +0100
@@ -0,0 +1,65 @@
+Initialized empty Git repository in gitrepo/.git/
+
+Switched to a new branch "branch1"
+Switched to a new branch "branch2"
+Switched to branch "master"
+Trying simple merge with 9497a4ee62e16ee641860d7677cdb2589ea15554
+Trying simple merge with e5023f9e5cb24fdcec7b6c127cec45d8888e35a9
+Merge made by octopus.
+ beta  |    1 +
+ gamma |    1 +
+ 2 files changed, 2 insertions(+), 0 deletions(-)
+ create mode 100644 beta
+ create mode 100644 gamma
+fetching from : git://localhost/gitrepo
+importing Hg objects into Git
+Counting objects: 14, done.
+Compressing objects:  11% (1/9)   
Compressing objects:  22% (2/9)   
Compressing objects:  33% (3/9)   
Compressing objects:  44% (4/9)   
Compressing objects:  55% (5/9)   
Compressing objects:  66% (6/9)   
Compressing objects:  77% (7/9)   
Compressing objects:  88% (8/9)   
Compressing objects: 100% (9/9)   
Compressing objects: 100% (9/9), done.
+Total 14 (delta 3), reused 0 (delta 0)
+importing Git objects into Hg
+at: 0/5
+updating working directory
+4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+@    changeset:   5:7acfed59bdde
+|\   tag:         master
+| |  tag:         default/master
+| |  tag:         tip
+| |  parent:      1:1436150b86c2
+| |  parent:      4:6e0acfc91939
+| |  user:        test <test@example.org>
+| |  date:        Mon Jan 01 00:00:13 2007 +0000
+| |  summary:     Merge branches 'branch1' and 'branch2'
+| |
+| o    changeset:   4:6e0acfc91939
+| |\   parent:      2:7bcd915dc873
+| | |  parent:      3:37c124f2d0a0
+| | |  user:        test <test@example.org>
+| | |  date:        Mon Jan 01 00:00:13 2007 +0000
+| | |  summary:     Merge branches 'branch1' and 'branch2'
+| | |
+| | o  changeset:   3:37c124f2d0a0
+| | |  tag:         branch2
+| | |  tag:         default/branch2
+| | |  parent:      0:3442585be8a6
+| | |  user:        test <test@example.org>
+| | |  date:        Mon Jan 01 00:00:12 2007 +0000
+| | |  summary:     add gamma
+| | |
+| o |  changeset:   2:7bcd915dc873
+| |/   tag:         branch1
+| |    tag:         default/branch1
+| |    parent:      0:3442585be8a6
+| |    user:        test <test@example.org>
+| |    date:        Mon Jan 01 00:00:11 2007 +0000
+| |    summary:     add beta
+| |
+o |  changeset:   1:1436150b86c2
+|/   user:        test <test@example.org>
+|    date:        Mon Jan 01 00:00:13 2007 +0000
+|    summary:     add delta
+|
+o  changeset:   0:3442585be8a6
+   user:        test <test@example.org>
+   date:        Mon Jan 01 00:00:10 2007 +0000
+   summary:     add alpha
+