diff options
| author | Glenn Morris | 2018-01-31 15:05:14 -0500 |
|---|---|---|
| committer | Glenn Morris | 2018-01-31 15:05:14 -0500 |
| commit | 113963a89d3f5d2692a56007676b78104f6dfce7 (patch) | |
| tree | 504f4787d7e8a2da692fb592845dcdbf408994fe /admin/automerge | |
| parent | aac3ba4d432d57733420a7ab5d680cfb90aa1ccd (diff) | |
| download | emacs-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-x | admin/automerge | 32 |
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 | ||
| 32 | die () # write error to stderr and exit | 37 | die () # 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. | ||
| 44 | cd $PD | ||
| 45 | cd ../ | ||
| 46 | [ -d admin ] || die "Could not locate admin directory" | ||
| 47 | |||
| 48 | [ -e .git ] || die "No .git" | ||
| 49 | |||
| 50 | usage () | 48 | usage () |
| 51 | { | 49 | { |
| 52 | cat 1>&2 <<EOF | 50 | cat 1>&2 <<EOF |
| 53 | Usage: ${PN} [-b] [-e emacs] [-n nmin] [-p] [-r] [-t] [-- make-flags] | 51 | Usage: ${PN} [-b] [-d dir] [-e emacs] [-n nmin] [-p] [-r] [-t] [-- mflags] |
| 54 | Merge the Emacs release branch to master. | 52 | Merge the Emacs release branch to master. |
| 55 | Passes any non-option args to make (eg -- -j2). | 53 | Passes any non-option args to make (eg -- -j2). |
| 56 | Options: | 54 | Options: |
| 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= | |||
| 74 | push= | 73 | push= |
| 75 | quiet= | 74 | quiet= |
| 76 | reset= | 75 | reset= |
| 76 | dir= | ||
| 77 | 77 | ||
| 78 | while getopts ":hbe:n:pqrt" option ; do | 78 | while 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 )) | |||
| 104 | OPTIND=1 | 106 | OPTIND=1 |
| 105 | 107 | ||
| 106 | 108 | ||
| 109 | if [ "$dir" ]; then | ||
| 110 | cd "$dir" || die | ||
| 111 | else | ||
| 112 | cd $PD # this should be the admin directory | ||
| 113 | cd ../ | ||
| 114 | fi | ||
| 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 |