aboutsummaryrefslogtreecommitdiffstats
path: root/admin/automerge
diff options
context:
space:
mode:
authorGlenn Morris2018-01-31 15:05:14 -0500
committerGlenn Morris2018-01-31 15:05:14 -0500
commit113963a89d3f5d2692a56007676b78104f6dfce7 (patch)
tree504f4787d7e8a2da692fb592845dcdbf408994fe /admin/automerge
parentaac3ba4d432d57733420a7ab5d680cfb90aa1ccd (diff)
downloademacs-113963a89d3f5d2692a56007676b78104f6dfce7.tar.gz
emacs-113963a89d3f5d2692a56007676b78104f6dfce7.zip
automerge: add option to work in specific directory
* admin/automerge (usage): Mention -d. (dir): New variable. (-d): New option. (main): If requested, cd to specified directory.
Diffstat (limited to 'admin/automerge')
-rwxr-xr-xadmin/automerge32
1 files changed, 23 insertions, 9 deletions
diff --git a/admin/automerge b/admin/automerge
index 218ecb067c7..6182ad01a55 100755
--- a/admin/automerge
+++ b/admin/automerge
@@ -28,6 +28,11 @@
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 calls this script with -r -p. 30## Have a cron job that calls this script with -r -p.
31##
32## Modifying a running shell script can have unpredictable results,
33## so the paranoid will first make a copy of this script, and then run
34## it with the -d option to point to the repository directory, in case
35## a pull updates this script while it is working.
31 36
32die () # write error to stderr and exit 37die () # write error to stderr and exit
33{ 38{
@@ -40,20 +45,14 @@ PD=${0%/*}
40 45
41[ "$PD" = "$0" ] && PD=. # if PATH includes PWD 46[ "$PD" = "$0" ] && PD=. # if PATH includes PWD
42 47
43## This should be the admin directory.
44cd $PD
45cd ../
46[ -d admin ] || die "Could not locate admin directory"
47
48[ -e .git ] || die "No .git"
49
50usage () 48usage ()
51{ 49{
52 cat 1>&2 <<EOF 50 cat 1>&2 <<EOF
53Usage: ${PN} [-b] [-e emacs] [-n nmin] [-p] [-r] [-t] [-- make-flags] 51Usage: ${PN} [-b] [-d dir] [-e emacs] [-n nmin] [-p] [-r] [-t] [-- mflags]
54Merge the Emacs release branch to master. 52Merge the Emacs release branch to master.
55Passes any non-option args to make (eg -- -j2). 53Passes any non-option args to make (eg -- -j2).
56Options: 54Options:
55-d: directory to work in (default is parent directory of this script)
57-e: Emacs executable to use for the initial merge (default $emacs) 56-e: Emacs executable to use for the initial merge (default $emacs)
58-n: minimum number of commits to try merging (default $nmin) 57-n: minimum number of commits to try merging (default $nmin)
59-b: try to build after merging 58-b: try to build after merging
@@ -74,13 +73,16 @@ test=
74push= 73push=
75quiet= 74quiet=
76reset= 75reset=
76dir=
77 77
78while getopts ":hbe:n:pqrt" option ; do 78while getopts ":hbd:e:n:pqrt" option ; do
79 case $option in 79 case $option in
80 (h) usage ;; 80 (h) usage ;;
81 81
82 (b) build=1 ;; 82 (b) build=1 ;;
83 83
84 (d) dir=$OPTARG ;;
85
84 (e) emacs=$OPTARG ;; 86 (e) emacs=$OPTARG ;;
85 87
86 (n) nmin=$OPTARG ;; 88 (n) nmin=$OPTARG ;;
@@ -104,6 +106,18 @@ shift $(( --OPTIND ))
104OPTIND=1 106OPTIND=1
105 107
106 108
109if [ "$dir" ]; then
110 cd "$dir" || die
111else
112 cd $PD # this should be the admin directory
113 cd ../
114fi
115
116[ -d admin ] || die "Could not locate admin directory"
117
118[ -e .git ] || die "No .git"
119
120
107## Does not work 100% because a lot of Emacs batch output comes on 121## Does not work 100% because a lot of Emacs batch output comes on
108## stderr (?). 122## stderr (?).
109[ "$quiet" ] && exec 1> /dev/null 123[ "$quiet" ] && exec 1> /dev/null