emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master aac3ba4: automerge: add option to start with a rese


From: Glenn Morris
Subject: [Emacs-diffs] master aac3ba4: automerge: add option to start with a reset
Date: Wed, 31 Jan 2018 12:54:53 -0500 (EST)

branch: master
commit aac3ba4d432d57733420a7ab5d680cfb90aa1ccd
Author: Glenn Morris <address@hidden>
Commit: Glenn Morris <address@hidden>

    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.
---
 admin/automerge | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/admin/automerge b/admin/automerge
index 94b41d2..218ecb0 100755
--- a/admin/automerge
+++ b/admin/automerge
@@ -27,8 +27,7 @@
 ## and then push it.
 ## Intended usage:
 ## Have a dedicated git directory just for this.
-## Have a cron job that does a hard reset (to clean up after any
-## previous failures), then a git pull, then calls this script with -p.
+## Have a cron job that calls this script with -r -p.
 
 die ()                 # write error to stderr and exit
 {
@@ -51,15 +50,16 @@ cd ../
 usage ()
 {
     cat 1>&2 <<EOF
-Usage: ${PN} [-b] [-e emacs] [-n nmin] [-p] [-t] [-- make-flags]
+Usage: ${PN} [-b] [-e emacs] [-n nmin] [-p] [-r] [-t] [-- make-flags]
 Merge the Emacs release branch to master.
 Passes any non-option args to make (eg -- -j2).
 Options:
 -e: Emacs executable to use for the initial merge (default $emacs)
--n: Minimum number of commits to try merging (default $nmin)
+-n: minimum number of commits to try merging (default $nmin)
 -b: try to build after merging
 -t: try to check after building
 -p: if merge, build, check all succeed, push when finished (caution!)
+-r: start by doing a hard reset (caution!) and pull
 EOF
     exit 1
 }
@@ -73,8 +73,9 @@ build=
 test=
 push=
 quiet=
+reset=
 
-while getopts ":hbe:n:pqt" option ; do
+while getopts ":hbe:n:pqrt" option ; do
     case $option in
         (h) usage ;;
 
@@ -88,6 +89,8 @@ while getopts ":hbe:n:pqt" option ; do
 
         (q) quiet=1 ;;
 
+        (r) reset=1 ;;
+
         (t) test=1 ;;
 
         (\?) die "Bad option -$OPTARG" ;;
@@ -121,6 +124,15 @@ trap "rm -f $tempfile 2> /dev/null" EXIT
 }
 
 
+[ "$reset" ] && {
+    echo "Resetting..."
+    git reset --hard origin/master || die "reset error"
+
+    echo "Pulling..."
+    git pull --ff-only || die "pull error"
+}
+
+
 rev=$(git rev-parse HEAD)
 
 [ $(git rev-parse @{u}) = $rev ] || die "Local state does not match origin"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]