forked from mozilla/moz-git-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
git-push-to-try
executable file
·53 lines (41 loc) · 1.1 KB
/
git-push-to-try
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
#
# Usage: git-push-to-try [-t|--tip] [-r REVS|--rev REVS] HG_REPO TRY_PARAMS
set -e
PATH=$(dirname $0):$PATH
function hg_cmd() {
#echo "hg "$@"" >&2
hg -R "$hg_repo" -q $@ > /dev/null
}
# Sigh, command-line parsing in bash is so much fun.
while true; do
if [[ "$1" == "-t" || "$1" == "--tip" ]]; then
tip_cmd="--tip"
shift
continue
fi
if [[ "$1" == "-r" || "$1" == "--rev" ]]; then
revs="$2"
shift
shift
continue
fi
break
done
hg_repo=$1
shift
git-push-to-hg $tip_cmd $revs "$hg_repo"
# avoid using process substitution because Windows.
# Use a temp file instead.
commit_msg_filename=$TMP/git-temp-$RANDOM-$$
commit_msg=$(hg log -R "$hg_repo" -l1 --template '{desc}')
echo "try: $@ $commit_msg" > $commit_msg_filename
hg_cmd qref -sl $commit_msg_filename
rm $commit_msg_filename
echo "try: $@"
hg -R "$hg_repo" push -f ssh://hg.mozilla.org/try
echo
echo "https://tbpl.mozilla.org/?tree=Try&rev=$(hg -R "$hg_repo" log -l1 --template "{node|short}")"
# reset phases - probably not needed once bug 725362 lands.
hg_cmd phase --force --draft "mq()"
hg_cmd qpop -a