diff options
Diffstat (limited to 'exporters/darcs/d2x')
-rwxr-xr-x | exporters/darcs/d2x | 112 |
1 files changed, 0 insertions, 112 deletions
diff --git a/exporters/darcs/d2x b/exporters/darcs/d2x deleted file mode 100755 index 85e15e2..0000000 --- a/exporters/darcs/d2x +++ /dev/null @@ -1,112 +0,0 @@ -#!/bin/sh -# -# d2x - convert darcs repos to git, bzr or hg using fast-import -# -# Copyright (c) 2008 by Miklos Vajna <vmiklos@frugalware.org> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# - -usage() -{ - echo "Usage: d2x -f format darcsrepo" -} - -die() -{ - echo "$@" - usage - exit 1 -} - -check_up_to_date() -{ - upstreamnum=$(cd $origin; darcs show repo|grep 'Num Patches'|sed 's/.*: //') - if [ "$upstreamnum" = "$(eval $*)" ]; then - echo "No remote changes to pull!" - exit 0 - fi -} - -case $1 in - -h|--help) - usage - exit 0 - ;; - -f) - format="$2" - shift 2 - ;; -esac - -[ -n "$format" ] || die "Target format is not given!" - -case $format in - git|bzr|hg) - ;; - *) - die "The requested target format is not yet supported!" - ;; -esac - -origin="$1" -shift 1 - -[ -d "$origin" ] || die "Source repo does not exist!" - -# convert to abspath -cd $origin -origin=$(pwd) - -dmark="$origin.$format/darcs/dfe-marks" -fmark="$origin.$format/darcs/ffi-marks" - -mkdir -p $origin.$format/darcs -cd $origin.$format - -common_opts="--working $origin.$format/darcs/repo --logfile $origin.$format/darcs/log $origin" -if [ ! -f $dmark ]; then - case $format in - git) - git --bare init - darcs-fast-export $* --export-marks=$dmark $common_opts | \ - git fast-import --export-marks=$fmark - ;; - bzr) - bzr init-repo . - darcs-fast-export $* --export-marks=$dmark $common_opts | \ - bzr fast-import --export-marks=$fmark - - ;; - hg) - hg init - darcs-fast-export $* $origin | \ - hg fastimport - - esac -else - case $format in - git) - check_up_to_date "git rev-list HEAD |wc -l" - darcs-fast-export $* --export-marks=$dmark --import-marks=$dmark $common_opts | \ - git fast-import --export-marks=$fmark --import-marks=$fmark - ;; - bzr) - check_up_to_date "cd master; bzr revno" - darcs-fast-export $* --export-marks=$dmark --import-marks=$dmark $common_opts | \ - bzr fast-import --export-marks=$fmark --import-marks=$fmark - - ;; - hg) - die "Incremental conversion to hg is not yet supported by hg fastimport." - ;; - esac -fi |