8 TMPBRANCH
=$MAINTBRANCH-$DEVBRANCH-$
(date "+%Y-%m-%d-%H-%M-%S")
10 if [ -z "$RELPATH" -o -z "$REMOTE" -o -z "$MAINTBRANCH" -o -z "$DEVBRANCH" ] ; then
12 echo "Merge any changes from the maintenance-branch into the development-branch."
13 echo "If there are no conflicts, then push the changes."
15 echo "Usage: $PROG <relpath> <remote> <maintenance-branch> <development-branch>"
17 echo "Example: $PROG drupal upstream 7.x-4.3 7.x-master"
21 pushd "$RELPATH" >> /dev
/null
22 ## OS X: mktemp requires "-t prefix" argument
23 ## GNU: mktemp accepts optional -t pattern" argument
24 ## The string "merge-forward-XXXXXX" works as a prefix or pattern
25 TMPFILE
=$
(mktemp
-t merge-forward-XXXXXX
)
29 git checkout
-b $TMPBRANCH $REMOTE/$DEVBRANCH
30 git merge
$REMOTE/$MAINTBRANCH |
tee $TMPFILE
33 if grep -q CONFLICT
"$TMPFILE" ; then
35 echo "==> Conflicted merge. Please resolve conflicts and then push with:"
37 echo "git push $REMOTE $TMPBRANCH:$DEVBRANCH"
38 elif grep -q "Already up-to-date." "$TMPFILE" ; then
40 echo "==> No update needed"
44 echo "==> Clean merge; proceeding with push"
47 git push
$REMOTE $TMPBRANCH:$DEVBRANCH
49 git checkout
$REMOTE/$DEVBRANCH
50 git branch
-d $TMPBRANCH