3 # Invoked from taskd/taskd.pl
10 proj
="${projdir%.git}"
12 cd "$cfg_reporoot/$projdir"
13 trap "echo '@OVER@'; touch .clone_failed" EXIT
14 url
="$(config_get baseurl)"
16 if [ "$cfg_project_owners" = "source" ]; then
17 config_set owner
"$(stat -c %U "$url" 2>/dev/null)"
20 mail="$(config_get owner)"
23 echo "Initiating mirroring..."
25 svn
://* | svn
+http
://* | svn
+https
://*)
26 # we just remote svn+ here, so svn+http://... becomes http://...
28 GIT_DIR
=. git svn clone
"$svnurl" .
29 # Neat Trick suggested by Miklos Vajna
30 # Removed by fasterfood/interstate -- causing errors.
33 httpurl
="${url/darcs:\/\//http://}"
34 "$cfg_basedir"/bin
/darcs-fast-export
--export-marks=$
(pwd)/dfe-marks
"$httpurl" | \
35 git fast-import
--export-marks=$
(pwd)/gfi-marks
36 # This is here because by default only the exit code of
37 # git fast-import is checked
38 [ ${PIPESTATUS[0]} = 0 -a ${PIPESTATUS[1]} = 0 ]
41 # we just remove bzr:// here, a typical bzr url is just
43 bzrurl
="${url#bzr://}"
44 bzr fast-export
--export-marks=$
(pwd)/bfe-marks
"$bzrurl" | \
45 git fast-import
--export-marks=$
(pwd)/gfi-marks
46 [ ${PIPESTATUS[0]} = 0 -a ${PIPESTATUS[1]} = 0 ]
49 git remote
rm origin
>/dev
/null
2>&1 ||
:
50 git remote add
--mirror origin
"$url"
52 git remote prune origin
57 echo "Final touches..."
58 git update-server-info
60 mail -s "[$cfg_name] $proj clone completed" "$mail,$cfg_admin" <<EOT
61 Congratulations! The clone of project $proj just completed.
64 * GitWeb interface: $cfg_gitweburl/$projdir
65 * Project settings: $cfg_webadmurl/editproj.cgi?name=$proj
70 echo "Mirroring finished successfuly!"