3 # d2x - convert darcs repos to git, bzr or hg using fast-import
5 # Copyright (c) 2008 by Miklos Vajna <vmiklos@frugalware.org>
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
25 echo "Usage: d2x -f format darcsrepo"
37 upstreamnum
=$
(cd $origin; darcs show repo|
grep 'Num Patches'|
sed 's/.*: //')
38 if [ "$upstreamnum" = "$(eval $*)" ]; then
39 echo "No remote changes to pull!"
55 [ -n "$format" ] || die
"Target format is not given!"
61 die
"The requested target format is not yet supported!"
68 [ -d "$origin" ] || die
"Source repo does not exist!"
74 dmark
="$origin.$format/darcs/dfe-marks"
75 fmark
="$origin.$format/darcs/ffi-marks"
77 mkdir
-p $origin.
$format/darcs
80 common_opts
="--working $origin.$format/darcs/repo --logfile $origin.$format/darcs/log $origin"
81 if [ ! -f $dmark ]; then
85 darcs-fast-export $
* --export-marks=$dmark $common_opts | \
86 git fast-import
--export-marks=$fmark
90 darcs-fast-export $
* --export-marks=$dmark $common_opts | \
91 bzr fast-import
--export-marks=$fmark -
95 darcs-fast-export $
* $origin | \
101 check_up_to_date
"git rev-list HEAD |wc -l"
102 darcs-fast-export $
* --export-marks=$dmark --import-marks=$dmark $common_opts | \
103 git fast-import
--export-marks=$fmark --import-marks=$fmark
106 check_up_to_date
"cd master; bzr revno"
107 darcs-fast-export $
* --export-marks=$dmark --import-marks=$dmark $common_opts | \
108 bzr fast-import
--export-marks=$fmark --import-marks=$fmark -
111 die
"Incremental conversion to hg is not yet supported by hg fastimport."