From 4e6b43838174ce77de237b53a7c3806d10640bb1 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Sat, 28 Nov 2009 01:03:44 +0100 Subject: [PATCH] Add support for mirroring darcs repos --- jobd/update.sh | 4 ++++ shlib.sh | 8 ++++++++ taskd/clone.sh | 5 +++++ 3 files changed, 17 insertions(+) diff --git a/jobd/update.sh b/jobd/update.sh index 3aa0357..dd31dbb 100755 --- a/jobd/update.sh +++ b/jobd/update.sh @@ -27,6 +27,10 @@ case "$url" in GIT_DIR=. bang git svn fetch GIT_DIR=. bang git fetch ;; + darcs://*) + httpurl="${url/darcs:\/\//http:\/\/}" + bang git_darcs_fetch "$httpurl" + ;; *) [ "$url" = "$(config_get remote.origin.url)" ] || bang config_set_raw remote.origin.url "$url" bang git remote update diff --git a/shlib.sh b/shlib.sh index 5224073..55298eb 100644 --- a/shlib.sh +++ b/shlib.sh @@ -101,3 +101,11 @@ get_repo_list() { [ $id -lt 65536 ] || echo "$name" done } + +# fast-import with error handling +git_darcs_fetch() { + darcs-fast-export --export-marks=$(pwd)/dfe-marks --import-marks=$(pwd)/dfe-marks "$1" | \ + git fast-import --export-marks=$(pwd)/gfi-marks --import-marks=$(pwd)/gfi-marks + [ $PIPESTATUS[0] = 0 -a $PIPESTATUS[1] = 0 ] + return $? +} diff --git a/taskd/clone.sh b/taskd/clone.sh index 0240968..13b943a 100755 --- a/taskd/clone.sh +++ b/taskd/clone.sh @@ -32,6 +32,11 @@ case "$url" in GIT_DIR=. git config remote.origin.fetch +refs/remotes/tags/*:refs/tags/* GIT_DIR=. git fetch ;; + darcs://*) + httpurl="${url/darcs:\/\//http:\/\/}" + darcs-fast-export --export-marks=$(pwd)/dfe-marks "$httpurl" | \ + git fast-import --export-marks=$(pwd)/gfi-marks + ;; *) git remote rm origin >/dev/null 2>&1 || : git remote add --mirror origin "$url" -- 2.11.4.GIT