5 # darcs fast-export | git fast-import with error handling
7 "$cfg_basedir"/bin
/darcs-fast-export
--export-marks=$
(pwd)/dfe-marks
--import-marks=$
(pwd)/dfe-marks
"$1" | \
8 git fast-import
--export-marks=$
(pwd)/gfi-marks
--import-marks=$
(pwd)/gfi-marks
9 [ ${PIPESTATUS[0]} = 0 -a ${PIPESTATUS[1]} = 0 ]
13 # bzr fast-export | git fast-import with error handling
15 bzr fast-export
--export-marks=$
(pwd)/dfe-marks
--import-marks=$
(pwd)/dfe-marks
"$1" | \
16 git fast-import
--export-marks=$
(pwd)/gfi-marks
--import-marks=$
(pwd)/gfi-marks
17 [ ${PIPESTATUS[0]} = 0 -a ${PIPESTATUS[1]} = 0 ]
23 cd "$cfg_reporoot/$proj.git"
25 if check_interval lastrefresh
$cfg_min_mirror_interval; then
26 progress
"= [$proj] update skip (last at $(config_get lastrefresh))"
29 progress
"+ [$proj] update (`date`)"
35 url
="$(config_get baseurl)"
36 mail="$(config_get owner)"
38 bang git for-each-ref
--format '%(refname) %(objectname)' >.refs-before
41 svn
://* | svn
+http
://* | svn
+https
://*)
42 GIT_DIR
=. bang git svn fetch
43 GIT_DIR
=. bang git fetch
46 httpurl
="${url/darcs:\/\//http://}"
47 bang git_darcs_fetch
"$httpurl"
50 bzrurl
="${url#bzr://}"
51 bang git_bzr_fetch
"$bzrurl"
54 [ "$url" = "$(config_get remote.origin.url)" ] || bang config_set_raw remote.origin.url
"$url"
55 bang git remote update
56 bang git remote prune origin
60 bang git update-server-info
61 bang config_set lastrefresh
"$(date -R)"
63 # Look at which refs changed and trigger ref-change for these
64 bang git for-each-ref
--format '%(refname) %(objectname)' >.refs-after
65 sockpath
="$cfg_chroot/etc/taskd.socket"
66 if [ -S "$sockpath" ] && ! cmp -s .refs-before .refs-after
; then
67 join -j 1 .refs-before .refs-after |
68 while read ref old new
; do
69 [ "$old" != "$new" ] ||
continue
70 echo "ref-change -1 $proj $old $new $ref" | nc.openbsd
-w 1 -U "$sockpath"
72 join -j 1 -v 1 .refs-before .refs-after |
73 while read ref old
; do
74 echo "ref-change -1 $proj $old 0000000000000000000000000000000000000000 $ref" | nc.openbsd
-w 1 -U "$sockpath"
76 join -j 1 -v 2 .refs-before .refs-after |
77 while read ref new
; do
78 echo "ref-change -1 $proj 0000000000000000000000000000000000000000 $new $ref" | nc.openbsd
-w 1 -U "$sockpath"
82 rm -f .refs-before .refs-after
84 if [ -e .banged
]; then
85 echo "$proj update succeeded - failure recovery" |
mail -s "[$cfg_name] $proj update succeeded" "$mail,$cfg_admin"
89 progress
"- [$proj] update (`date`)"