3 # FIXME this script is duplicated from update-oojs-ui.sh - factor this out
5 # This script generates a commit that updates the oojs distribution
6 # ./bin/update-oojs.sh path/to/repo/for/oojs
9 grep "OOjs v" resources
/oojs
/oojs.js \
11 |
grep -Eo '\([a-z0-9]+\)' \
17 grep "OOjs v" resources
/oojs
/oojs.js \
19 |
grep -Eo '\bv[0-9a-z.-]+\b'
22 function oojsversion
() {
23 grep "OOjs v" resources
/oojs
/oojs.js \
25 |
grep -Eo '\bv[0-9a-z.-]+\b.*$'
28 # cd to the MW directory
29 cd $
(cd $
(dirname $0)/..
/..
; pwd)
33 echo >&2 "Usage: update-oojs.sh path/to/repo/for/oojs"
37 # Undo any changes in the oojs directory
38 git
reset resources
/oojs
/
39 git checkout resources
/oojs
/
42 # Create a branch of MW if needed, and reset it to master
43 git checkout
-B update-oojs origin
/master
45 # Get the old oojs version
46 OLDVERSION
=$
(oojshash
)
47 if [ "x$OLDVERSION" == "x" ]
52 # cd to the oojs directory
54 if [ "x$OLDVERSION" == "x" ]
57 OLDVERSION
=$
(git rev-parse
$TAG)
60 echo Could not
find OOjs version
65 if [ "$(git rev-parse $OLDVERSION)" == "$(git rev-parse HEAD)" ]
67 echo "No changes (already at $OLDVERSION)"
71 # Build the distribution
74 # Get the list of changes
75 NEWCHANGES
=$
(git log
$OLDVERSION..
--oneline --no-merges --reverse --color=never
)
76 NEWCHANGESDISPLAY
=$
(git log
$OLDVERSION..
--oneline --no-merges --reverse --color=always
)
77 # cd back to the VisualEditor directory
80 # Copy files from dist/ to resources/oojs/
81 cp -a $1/dist
/* resources
/oojs
/
82 # Figure out what the new version is
83 NEWVERSION
=$
(oojsversion
)
84 # Generate commit summary
86 Update OOjs to $NEWVERSION
93 git commit resources
/oojs
/ -m "$COMMITMSG"
97 Created commit with changes: