aboutsummaryrefslogtreecommitdiffstats
path: root/admin/automerge
diff options
context:
space:
mode:
authorGlenn Morris2018-01-31 12:54:26 -0500
committerGlenn Morris2018-01-31 12:54:26 -0500
commitaac3ba4d432d57733420a7ab5d680cfb90aa1ccd (patch)
treedfe199cc4a44e0d12b25de1d3337f9952dfda424 /admin/automerge
parent4dbc1ef5e6cf55426d023be563ff93d74b675218 (diff)
downloademacs-aac3ba4d432d57733420a7ab5d680cfb90aa1ccd.tar.gz
emacs-aac3ba4d432d57733420a7ab5d680cfb90aa1ccd.zip
automerge: add option to start with a reset
* admin/automerge (usage): Mention -r. (reset): New variable. (-r): New option. (main): If requested, do a reset and pull.
Diffstat (limited to 'admin/automerge')
-rwxr-xr-xadmin/automerge22
1 files changed, 17 insertions, 5 deletions
diff --git a/admin/automerge b/admin/automerge
index 94b41d2cdca..218ecb067c7 100755
--- a/admin/automerge
+++ b/admin/automerge
@@ -27,8 +27,7 @@
27## and then push it. 27## and then push it.
28## Intended usage: 28## Intended usage:
29## Have a dedicated git directory just for this. 29## Have a dedicated git directory just for this.
30## Have a cron job that does a hard reset (to clean up after any 30## Have a cron job that calls this script with -r -p.
31## previous failures), then a git pull, then calls this script with -p.
32 31
33die () # write error to stderr and exit 32die () # write error to stderr and exit
34{ 33{
@@ -51,15 +50,16 @@ cd ../
51usage () 50usage ()
52{ 51{
53 cat 1>&2 <<EOF 52 cat 1>&2 <<EOF
54Usage: ${PN} [-b] [-e emacs] [-n nmin] [-p] [-t] [-- make-flags] 53Usage: ${PN} [-b] [-e emacs] [-n nmin] [-p] [-r] [-t] [-- make-flags]
55Merge the Emacs release branch to master. 54Merge the Emacs release branch to master.
56Passes any non-option args to make (eg -- -j2). 55Passes any non-option args to make (eg -- -j2).
57Options: 56Options:
58-e: Emacs executable to use for the initial merge (default $emacs) 57-e: Emacs executable to use for the initial merge (default $emacs)
59-n: Minimum number of commits to try merging (default $nmin) 58-n: minimum number of commits to try merging (default $nmin)
60-b: try to build after merging 59-b: try to build after merging
61-t: try to check after building 60-t: try to check after building
62-p: if merge, build, check all succeed, push when finished (caution!) 61-p: if merge, build, check all succeed, push when finished (caution!)
62-r: start by doing a hard reset (caution!) and pull
63EOF 63EOF
64 exit 1 64 exit 1
65} 65}
@@ -73,8 +73,9 @@ build=
73test= 73test=
74push= 74push=
75quiet= 75quiet=
76reset=
76 77
77while getopts ":hbe:n:pqt" option ; do 78while getopts ":hbe:n:pqrt" option ; do
78 case $option in 79 case $option in
79 (h) usage ;; 80 (h) usage ;;
80 81
@@ -88,6 +89,8 @@ while getopts ":hbe:n:pqt" option ; do
88 89
89 (q) quiet=1 ;; 90 (q) quiet=1 ;;
90 91
92 (r) reset=1 ;;
93
91 (t) test=1 ;; 94 (t) test=1 ;;
92 95
93 (\?) die "Bad option -$OPTARG" ;; 96 (\?) die "Bad option -$OPTARG" ;;
@@ -121,6 +124,15 @@ trap "rm -f $tempfile 2> /dev/null" EXIT
121} 124}
122 125
123 126
127[ "$reset" ] && {
128 echo "Resetting..."
129 git reset --hard origin/master || die "reset error"
130
131 echo "Pulling..."
132 git pull --ff-only || die "pull error"
133}
134
135
124rev=$(git rev-parse HEAD) 136rev=$(git rev-parse HEAD)
125 137
126[ $(git rev-parse @{u}) = $rev ] || die "Local state does not match origin" 138[ $(git rev-parse @{u}) = $rev ] || die "Local state does not match origin"