-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathmass-tag
executable file
·53 lines (41 loc) · 1.08 KB
/
mass-tag
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
#
# Apply the git same tag to all repositories in build, and push it upstream.
#
if [[ -z $1 ]]; then
(cat <<-EOF
Usage: $0 [-d] <tag>
-d : instead of setting it, delete the tag
WARNING: THIS WILL APPLY <tag> TO ALL LSST/DMS REPOSITORIES IN ./build
AND IMMEDIATELY PUSH THEM TO THE UPSTREAM GIT SERVER.
EXERCISE EXTREME CAUTION.
EOF
) >&2
exit 1
fi
if [[ "$1" == "-d" ]]; then
DELETE=1
shift
fi
TAG=$1
set -e
cd build
# For all git repositories:
for gg in */.git; do
(
r=$(dirname "$gg")
cd "$r"
ORIGIN=$(git config --get-all remote.origin.url | grep "LSST/DMS/" | sed 's|git://git.lsstcorp.org/|[email protected]:|')
# it appears that shellcheck does not like continue in a sub-shell
[[ -z $ORIGIN ]] && exit
echo "# $r $ORIGIN"
if [[ $DELETE != 1 ]]; then
git tag -a -m "Version $TAG" "$TAG"
git push "$ORIGIN" "refs/tags/${TAG}"
else
git tag -d "$TAG"
git push "$ORIGIN" ":refs/tags/${TAG}"
fi
)
done
# vim: tabstop=2 shiftwidth=2 expandtab