diff options
author | Paul Sherwood <paul.sherwood@codethink.co.uk> | 2013-08-17 22:41:22 +0000 |
---|---|---|
committer | Paul Sherwood <paul.sherwood@codethink.co.uk> | 2013-08-17 22:41:22 +0000 |
commit | 7e6d33388bac4ff13e8c61475809209515141a7a (patch) | |
tree | fc2dfe4f8d751f03867aab3b8993fbc9380387bf | |
parent | 5af9cb51c4932583b57dd65d6055f0439ac2cb6a (diff) | |
download | morphs-7e6d33388bac4ff13e8c61475809209515141a7a.tar.gz |
wip script wont keep going if git merge stops
-rwxr-xr-x | all-update.sh | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/all-update.sh b/all-update.sh new file mode 100755 index 0000000..c6f5b49 --- /dev/null +++ b/all-update.sh @@ -0,0 +1,73 @@ +#!/bin/sh + +# Copyright (C) 2013 Codethink Limited +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +set -e + +usage() { + echo "Usage: all-update your-system" + echo + echo "This attempts to merge up to the latest tag for all the chunks in your-system" + echo "It's re-runnable, and does morph edit to get each chunk." + echo "The process can take a while." +} + + +if [ -z "$1" ]; then + usage + exit 1 +fi + +workspace="$PWD"/../.. +system="$1" + +strata=`grep "morph.*: *" "$system.morph" | cut -d: -f2-` + +for stratum in $strata; do + chunks=`grep "name.*: *" "$stratum.morph" | cut -d: -f2-` + for chunk in $chunks; do + if [ "$chunk" != "$stratum" ]; then + echo editing $chunk + morph edit $system $stratum $chunk 1>&2 + fi + done +done + + +repos=`for stratum in $strata; do + grep "repo.*: *" "$stratum.morph" | cut -d: -f3- + done | sort -u` + +for repo in $repos; do + echo processing $repo + cd $workspace/*:$repo + if [ `git tag | wc -l` != "0" ]; then + startpoint=`git rev-parse HEAD` + echo startpoint is $startpoint + tag=`git describe --tags $(git rev-list --tags --max-count=1)` + echo "merging $tag in $repo" + foo=`git merge $tag 2>&1` + if [ $? != "0" ]; then + echo $foo + echo "need to reset $repo" + git reset --hard $startpoint + fi + else + echo "no tag found in $repo" + fi + endpoint=`git rev-parse HEAD` + echo endpoint is $endpoint +done |