summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Clatworthy <ian.clatworthy@canonical.com>2009-09-09 14:06:00 +1000
committerIan Clatworthy <ian.clatworthy@canonical.com>2009-09-09 14:06:00 +1000
commit9f1075d6e1eb931ce8075f549818b95e12b590d9 (patch)
tree3f40beff51c35b2a3e1e0c61ce84226cae9fc404
parente79d1c87f812e956ed36328f2740c03033b5407a (diff)
parent84a1786228541d383ee21087743f7bff5bce95ee (diff)
downloadpython-fastimport-9f1075d6e1eb931ce8075f549818b95e12b590d9.tar.gz
merge fixes for darcs-fast-import for better hg 1.3 interoperability
-rw-r--r--exporters/darcs/README21
-rwxr-xr-xexporters/darcs/d2x2
-rwxr-xr-xexporters/darcs/darcs-fast-import5
-rw-r--r--exporters/darcs/t/lib.sh8
-rw-r--r--exporters/darcs/t/test-hg.sh2
-rw-r--r--exporters/darcs/t/testimport-hg.sh1
6 files changed, 23 insertions, 16 deletions
diff --git a/exporters/darcs/README b/exporters/darcs/README
index 4b13e3b..3fc9449 100644
--- a/exporters/darcs/README
+++ b/exporters/darcs/README
@@ -23,13 +23,6 @@ Independent::
Ideally it should work with any fast importer, but actually it has been
tested with git fast-import, bzr fast-import and hg fastimport. (These
are the three fast-import implementations available ATM.)
- +
- hg fastimport needs three patches. While they are not in the upstream,
- you can get it from my repository using
-+
-----
-$ hg clone static-http://frugalware.org/~vmiklos/hg/hg-fastimport
-----
Formats::
It supports the 'darcs-2', 'hashed', and 'old-fashioned-inventory' darcs
@@ -127,16 +120,18 @@ supported by fastimport-0.6 is hg-1.0.x.
Mercurial (Hg) version:
----
$ hg version
-Mercurial Distributed SCM (version 1.2.1)
+Mercurial Distributed SCM (version 1.3)
----
-Strictly speaking this document is a wrong place to talk about enabling
-hg plugins. However...
+Strictly speaking this document is a wrong place to talk about
+configuring hg fastimport. However... you will need something like:
----
-$ cat ~/.hgrc
-[extensions]
-hgext.fastimport=
+$ hg clone http://vc.gerg.ca/hg/pyfastimport
+$ hg clone http://vc.gerg.ca/hg/hg-fastimport
+$ sudo ln -s /path/to/pyfastimport/fastimport /usr/lib/python2.6/site-packages/fastimport
+$ sudo ln -s /path/to/hg-fastimport/hgfastimport /usr/lib/python2.6/site-packages/hgfastimport
+echo -e "[extensions]\nfastimport = /usr/lib/python2.6/site-packages/hgfastimport" > ~/.hgrc
----
and once you installed the plugin correctly, you should have something like:
diff --git a/exporters/darcs/d2x b/exporters/darcs/d2x
index 79e18a3..959cc00 100755
--- a/exporters/darcs/d2x
+++ b/exporters/darcs/d2x
@@ -93,7 +93,7 @@ if [ ! -f $dmark ]; then
hg)
hg init
darcs-fast-export $* $origin | \
- hg fastimport /dev/stdin
+ hg fastimport -
esac
else
case $format in
diff --git a/exporters/darcs/darcs-fast-import b/exporters/darcs/darcs-fast-import
index e4392e7..0a1495d 100755
--- a/exporters/darcs/darcs-fast-import
+++ b/exporters/darcs/darcs-fast-import
@@ -81,6 +81,11 @@ class Handler:
raise Exception(s)
def get_date(self, ts, tz):
+ # first fix the case when tz is higher than +1200, as
+ # darcs won't accept it
+ if int(tz[:3]) > 12:
+ ts = str(int(ts) + 60*60*24)
+ tz = str(int(tz[:3])-24) + tz[3:]
# int(ts) is seconds since epoch. Since we're trying to
# capture both the absolute time of the commit and the
# localtime in the timezone of the committer, we need to turn
diff --git a/exporters/darcs/t/lib.sh b/exporters/darcs/t/lib.sh
index d82f6a8..1529f6f 100644
--- a/exporters/darcs/t/lib.sh
+++ b/exporters/darcs/t/lib.sh
@@ -150,6 +150,7 @@ create_hg()
hg pull ../$1.tmp
hg merge
echo D > file
+ hg resolve -m file
echo "first line
second line
third line" | hg commit -l /dev/stdin
@@ -176,6 +177,8 @@ third line" | hg commit -l /dev/stdin
echo test > subdir/file
hg add subdir/file
hg commit -m "add subdir file"
+ echo test2 > subdir/file
+ hg commit -m "commit with weird date" -d "Fri Apr 03 12:38:26 2009 +1300"
cd ..
}
create_git()
@@ -230,12 +233,14 @@ diff_git()
diff_importgit()
{
+ test -z "`(cd $1.darcs; darcs diff)`" &&
diff --exclude _darcs --exclude .git --exclude '*-darcs-backup*' -Nur $1 $1.darcs
return $?
}
diff_importhg()
{
+ test -z "`(cd $1.darcs; darcs diff)`" &&
diff --exclude _darcs --exclude .hg --exclude '*-darcs-backup*' --exclude 'hg-export.*' \
--exclude '.hgtags' --exclude '*.orig' -Nur $1 $1.darcs
return $?
@@ -243,12 +248,14 @@ diff_importhg()
diff_importdarcs()
{
+ test -z "`(cd $1.darcs; darcs diff)`" &&
diff --exclude _darcs --exclude '*-darcs-backup*' -Nur $1 $2
return $?
}
diff_importbzr()
{
+ test -z "`(cd $1.darcs; darcs diff)`" &&
diff --exclude _darcs --exclude .bzr --exclude '*-darcs-backup*' -Nur $1 $1.darcs
return $?
}
@@ -264,6 +271,7 @@ diff_bzr()
diff_hg()
{
+ hg -R $1.hg update
diff --exclude _darcs --exclude .hg --exclude '*-darcs-backup*' -Nur $1.hg $1
return $?
}
diff --git a/exporters/darcs/t/test-hg.sh b/exporters/darcs/t/test-hg.sh
index ddde37a..95bfc4b 100644
--- a/exporters/darcs/t/test-hg.sh
+++ b/exporters/darcs/t/test-hg.sh
@@ -8,7 +8,7 @@ cd test.hg
hg init
cd ..
if [ "$1" != "--stdout" ]; then
- darcs-fast-export test |(cd test.hg; hg fastimport /dev/stdin)
+ darcs-fast-export test |(cd test.hg; hg fastimport -)
diff_hg test
exit $?
else
diff --git a/exporters/darcs/t/testimport-hg.sh b/exporters/darcs/t/testimport-hg.sh
index 76df76d..7f6d215 100644
--- a/exporters/darcs/t/testimport-hg.sh
+++ b/exporters/darcs/t/testimport-hg.sh
@@ -8,7 +8,6 @@ cd test.darcs
darcs init
cd ..
(cd test; $pypath/bzrlib/plugins/fastimport/exporters/hg-fast-export.py -r .) | (cd test.darcs; darcs-fast-import)
-rm test/{*.orig,hg-export.status}
if [ $? != 0 ]; then
exit 1
fi