std/c/README.md: Add section skeletons and don't indent lists
[sunny256-utils.git] / git-push-to-gitlab
blob9cf4f4e71f6b50cff1f2b18cf08cdca22ddcbd93
1 #!/bin/sh
3 #==============================================================================
4 # git-push-to-gitlab
5 # File ID: 4f906152-875d-11ef-9cd0-754a1be59913
7 # [Description]
9 # Author: Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License version 2 or later.
11 #==============================================================================
13 progname=git-push-to-gitlab
14 VERSION=0.0.0
16 T_GREEN=$(tput setaf 2)
17 T_RESET=$(tput sgr0)
19 opt_help=0
20 opt_quiet=0
21 opt_verbose=0
23 while test -n "$1"; do
24 case "$1" in
25 -h|--help) opt_help=1; shift ;;
26 -q|--quiet) opt_quiet=$(($opt_quiet + 1)); shift ;;
27 -v|--verbose) opt_verbose=$(($opt_verbose + 1)); shift ;;
28 --version) echo $progname $VERSION; exit 0 ;;
29 --) shift; break ;;
31 if printf '%s\n' "$1" | grep -q ^-; then
32 echo "$progname: $1: Unknown option" >&2
33 exit 1
34 else
35 break
37 break ;;
38 esac
39 done
40 opt_verbose=$(($opt_verbose - $opt_quiet))
42 if test "$opt_help" = "1"; then
43 test $opt_verbose -gt 0 && { echo; echo $progname $VERSION; }
44 cat <<END
46 Usage: $progname [options]
48 Options:
50 -h, --help
51 Show this help.
52 -q, --quiet
53 Be more quiet. Can be repeated to increase silence.
54 -v, --verbose
55 Increase level of verbosity. Can be repeated.
56 --version
57 Print version information.
59 END
60 exit 0
63 if git branch | grep 'tmp-gitlab'; then
64 echo $progname: tmp-gitlab branch already exists >&2
65 exit 1
67 git fetch gitlab
68 for rev in $(git sht --reverse gitlab/master..master); do
69 echo
70 GIT_PAGER=cat git log -1 --format="$T_GREEN%h$T_RESET %s" $rev \
71 && echo git branch tmp-gitlab $rev \
72 && git branch tmp-gitlab $rev \
73 && echo git push -f gitlab tmp-gitlab:master \
74 && git push -f gitlab tmp-gitlab:master \
75 && echo git branch -D tmp-gitlab \
76 && git branch -D tmp-gitlab \
77 && if git sht gitlab/master..master | grep -q ^; then
78 printf '%s sleep 60...' $(date +%H:%M:%S)
79 sleep 60
80 echo ok
81 fi \
82 || exit 1
83 done
84 git pa -s
85 git push gitlab
87 # vim: set ts=8 sw=8 sts=8 noet fo+=w tw=79 fenc=UTF-8 :