Skip to content

Commit 26f3b8a

Browse files
committed
Add a helper to mirror Mercurial repositories, too
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent db30f6f commit 26f3b8a

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

git-hg-synchronizer.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/sh
2+
3+
# This script uses Git for Windows' remote-hg to mirror Mercurial repositories.
4+
# It is meant to be run as a Jenkins job.
5+
6+
set -e
7+
8+
GIT_HG="$(cd ../../ && pwd)"/git-hg
9+
test -d "$GIT_HG"/src || {
10+
mkdir -p "$GIT_HG"
11+
git clone git://github.com/msysgit/git "$GIT_HG"/src
12+
}
13+
test -x "$GIT_HG"/bin/git || (
14+
if ! dpkg -l libcurl4-openssl-dev libexpat1-dev gettext mercurial \
15+
> /dev/null
16+
then
17+
echo "Missing packages" >&2
18+
exit 1
19+
fi
20+
cd "$GIT_HG"/src &&
21+
git checkout devel &&
22+
make install prefix="$GIT_HG"
23+
)
24+
25+
export PATH="$GIT_HG"/bin:$PATH
26+
27+
HG_URL="$1"
28+
shift
29+
30+
test -d .git || git init
31+
test a"hg::$HG_URL" = a"$(git config remote.origin.url)" ||
32+
git remote add --mirror=fetch origin hg::"$HG_URL"
33+
34+
git fetch origin
35+
36+
for url
37+
do
38+
git push --all "$url"
39+
git push --tags "$url"
40+
done

0 commit comments

Comments
 (0)