diff options
| author | Glenn Morris | 2018-01-31 12:54:26 -0500 |
|---|---|---|
| committer | Glenn Morris | 2018-01-31 12:54:26 -0500 |
| commit | aac3ba4d432d57733420a7ab5d680cfb90aa1ccd (patch) | |
| tree | dfe199cc4a44e0d12b25de1d3337f9952dfda424 /admin/automerge | |
| parent | 4dbc1ef5e6cf55426d023be563ff93d74b675218 (diff) | |
| download | emacs-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-x | admin/automerge | 22 |
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 | ||
| 33 | die () # write error to stderr and exit | 32 | die () # write error to stderr and exit |
| 34 | { | 33 | { |
| @@ -51,15 +50,16 @@ cd ../ | |||
| 51 | usage () | 50 | usage () |
| 52 | { | 51 | { |
| 53 | cat 1>&2 <<EOF | 52 | cat 1>&2 <<EOF |
| 54 | Usage: ${PN} [-b] [-e emacs] [-n nmin] [-p] [-t] [-- make-flags] | 53 | Usage: ${PN} [-b] [-e emacs] [-n nmin] [-p] [-r] [-t] [-- make-flags] |
| 55 | Merge the Emacs release branch to master. | 54 | Merge the Emacs release branch to master. |
| 56 | Passes any non-option args to make (eg -- -j2). | 55 | Passes any non-option args to make (eg -- -j2). |
| 57 | Options: | 56 | Options: |
| 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 | ||
| 63 | EOF | 63 | EOF |
| 64 | exit 1 | 64 | exit 1 |
| 65 | } | 65 | } |
| @@ -73,8 +73,9 @@ build= | |||
| 73 | test= | 73 | test= |
| 74 | push= | 74 | push= |
| 75 | quiet= | 75 | quiet= |
| 76 | reset= | ||
| 76 | 77 | ||
| 77 | while getopts ":hbe:n:pqt" option ; do | 78 | while 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 | |||
| 124 | rev=$(git rev-parse HEAD) | 136 | rev=$(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" |