ooo-build r13153 - in trunk: . bin



Author: jannieuw
Date: Fri Jul 11 08:34:18 2008
New Revision: 13153
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13153&view=rev

Log:
2008-07-11  Jan Nieuwenhuizen  <janneke gnu org>

	* bin/gob-collapse-commits: New script.

	* bin/gob-bump: Use temporary branch do do the separate branch
	bumping.  Fixes accumulating previous patch-branches in subsequest
	patch-branches.  Use separate bump-update branch with collapsed
	commits to preserve commits in bumped master, while hiding them in
	bumped patch branches.  Filter most GIT output.

	* bin/gob-update: Nits.


Added:
   trunk/bin/gob-collapse-commits   (contents, props changed)
Modified:
   trunk/ChangeLog
   trunk/bin/gob-bump
   trunk/bin/gob-update

Modified: trunk/bin/gob-bump
==============================================================================
--- trunk/bin/gob-bump	(original)
+++ trunk/bin/gob-bump	Fri Jul 11 08:34:18 2008
@@ -6,9 +6,11 @@
 OPTIONS_SPEC="\
 gob-bump [options] <branch> <tag>
 --
+apply-dir=           use apply-dir
 continue             continue from previous run
+debug                print everything
 distro=              use branches for distro
-apply-dir=           use apply-dir
+limit=               bump only LIMIT branches
 
  BRANCH     Merge the newest changes from here
  TAG        To create the new gob-tag-name tag
@@ -16,6 +18,8 @@
 
 . git-sh-setup
 
+function log() { grep -E "^(CONFLICT|Created commit|Merge)" || true; }
+
 parse_config () {
 	while test $# != 0
 	 do
@@ -27,10 +31,18 @@
 		--continue)
 			continue=t
 			;;
+		--debug)
+			set -x
+			function log() { cat; }
+			;;
 		--distro)
 			shift
 			distro=$1
 			;;
+		--limit)
+			shift
+			limit=$1
+			;;
 		--)
 			shift
 			break ;;
@@ -52,17 +64,24 @@
 new_tag=gob-$2
 
 # setup
-this_branch=$(git-branch | grep '^\*' | sed -e 's/^\* //')
+this_branch=$(git-symbolic-ref HEAD | cut -b 12-)
+update_branch=gob-bump/work/update
 
-gob_bases=$(git-tag | grep '^gob-'; true)
+gob_bases=$(git-tag | grep '^gob-' || true)
 if test -z "$gob_bases"
 then
-	echo 'cannot find any gob-* tag, aborting'  1>&2
+	echo 'Cannot find any gob-* tag, aborting'  1>&2
 	exit 1
 fi
 
 # second run, tag already set?
-the_tag=$(git-tag | grep "^$new_tag\$"; true)
+the_tag=$(git-tag | grep "^$new_tag\$" || true)
+
+# find the last unpatched version and create a 'reset' commit
+# (actually this is one commit after that, we'll use ${one_ofter}^ to get
+# the right one)
+one_after=$(git-rev-list $this_branch --not $gob_bases | tail -n 1)
+latest_tag=$(git log --pretty=oneline -2 $one_after | tail -1 | sed -e s'/ .*//')
 
 if test -n "$the_tag" -a -z "$continue"
 then
@@ -70,21 +89,18 @@
 	exit 1
 elif test -z "$the_tag"
 then
-	# find the last unpatched version and create a 'reset' commit
-	# (actually this is one commit after that, we'll use ${one_ofter}^ to get
-	# the right one)
-	one_after=$(git-rev-list $this_branch --not $gob_bases | tail -n 1)
-
+	echo "Bumping: $this_branch"
 	# reset to the state of the last gob tag
 	if test -n "$one_after"
 	then
-		temp_branch=$(mktemp $(echo temp.$this_branch.XXXXXXXXXX | tr '/' '-'))
-		rm $temp_branch
-		git-checkout -b $temp_branch ${one_after}^
+		temp_branch=gob-bump/tmp/work
+		git branch -D $temp_branch 2>&1 | log
+		git-checkout -b $temp_branch $latest_tag
 		git-reset --soft $this_branch
-		git-commit -m 'Changes reverted to the last gob tag.' -a
+		git-commit -m "Reset tree to state of previous gob tag: $latest_tag." -a 2>&1 | log
 		git-checkout $this_branch
-		if git-merge $temp_branch
+		git clean -df > /dev/null 2>&1 | log
+		if git-merge $temp_branch 2>&1 | log
 		then
 			git-branch -d $temp_branch
 		else
@@ -93,11 +109,21 @@
 		fi
 	fi
 	
+	git checkout $this_branch
 	# get the newest changes and tag the tip
-	git-merge $new_changes
+	git-merge $new_changes 2>&1 | log
 	git-tag $new_tag
+
+	echo "Bumping: $update_branch"
+	## Keep commits in master this_branch, do all work with
+	## $update_branch: cannot seem to get around merging twice.
+	git branch -D $update_branch 2>&1 | log
+	git-checkout -b $update_branch
+	gob-collapse-commits $latest_tag
+	git-merge $new_changes 2>&1 | log
 fi
 
+git checkout $update_branch
 # update the branches
 if test -z "$apply_dir"
 then
@@ -111,37 +137,54 @@
 	fi
 	branches="$(gob --apply-dir=$apply_dir --distro=$distro branches)"
 fi
-broken='layout-plugin'
+
+broken='BROKEN-NONEMPTY'
 bumped=$(git branch | grep bumped/ | sed -e s'@bumped/@@' | tr -d ' ' | tr '\n' '|' | sed -e s'@|$@@')
 if test -n "$bumped" -a -z "$continue"
 then
 	echo 'bumped/* branches found, delete them or use --continue' 1>&2
 	exit 1
 fi
+
+i=0
 echo "$branches" | grep -Ev "^(${broken}|${bumped})\$" | while read branch
 do
 	echo "Bumping: $branch"
-	temp_branch=$(mktemp fixme.$branch.XXXXXXXXXX)
-	rm $temp_branch
+	temp_branch=gob-bump/tmp/$branch
+	temp_update=gob-bump/tmp/update
+	git branch -D $temp_branch $temp_update 2>&1 | log
 	git-checkout -b $temp_branch origin/$branch
-	if gob-update $this_branch
+	git branch $temp_update $update_branch
+	if gob-update $temp_update 2>&1 | log
 	then
-## let's push later...
-##		git-push
-		git-checkout $this_branch
- 		if git-merge $temp_branch
+		# Let's push later...
+		# git-push
+		git-checkout $temp_update
+ 		if git-merge $temp_branch 2>&1 | log
 		then
-## ...so preserve succesfully bumped branches locally
-##			git-branch -d $temp_branch
+			# ...so preserve succesfully bumped branches locally
+			# git-branch -d $temp_branch
+			git-checkout $temp_branch
 			git-branch -m $temp_branch bumped/$branch
+			git-branch -D $temp_update 2>&1 | log
 		else
 			echo "Merging back failed, please merge manually: $temp_branch" 1>&2
 		fi
 	else
-		echo "Update failed, please update manually: $temp_branch"  1>&2
+		echo "Update failed, please update manually: $temp_branch" 1>&2
+	fi
+	foo=$((i++))
+	if test -n "$limit" -a $i -gt 0$limit
+	then
+		echo Do only $limit
+		break
 	fi
 done
 
+git-checkout $this_branch
+# Do not delete, need for --continue
+# git-branch -D $update_branch 2>&1 | log
+
 # Local Variables:
 # sh-basic-offset:8
 # End:

Added: trunk/bin/gob-collapse-commits
==============================================================================
--- (empty file)
+++ trunk/bin/gob-collapse-commits	Fri Jul 11 08:34:18 2008
@@ -0,0 +1,36 @@
+#! /bin/sh
+
+set -e
+
+if test $# -lt 1
+then
+	echo "Usage: gob-collapse-commits <commit> [<commit>]"
+	exit 2
+fi
+
+begin=$1
+end=$2
+
+begin_log=$(git show --pretty=raw $begin | head -3 | tr '\n' ' ')
+begin_commit=$(expr "$begin_log" : '.*commit \([^ ]\+\)')
+begin_tree=$(expr "$begin_log" : '.*tree \([^ ]\+\)')
+begin_parent=$(expr "$begin_log" : '.*parent \([^ ]\+\)')
+
+end_log=$(git show --pretty=raw $end | head -3 | tr '\n' ' ')
+end_commit=$(expr "$end_log" : '.*commit \([^ ]\+\)')
+end_tree=$(expr "$end_log" : '.*tree \([^ ]\+\)')
+end_parent=$(expr "$end_log" : '.*parent \([^ ]\+\)')
+
+(echo gob-collapse-commits $begin_commit..$end_commit;
+ echo;
+ git-log -1 $begin_commit | tail -n +5;
+ echo '--';
+ git-log -1 $end_commit | tail -n +5;) \
+	| sed -e 's/^ \{4\}//' \
+	| git-commit-tree $end_tree -p $begin_commit > .git/NEW-HEAD || (rm -f .git/new-HEAD && exit 1)
+git reset --hard $(cat .git/NEW-HEAD)
+rm .git/NEW-HEAD
+
+# Local Variables:
+# sh-basic-offset:8
+# End:

Modified: trunk/bin/gob-update
==============================================================================
--- trunk/bin/gob-update	(original)
+++ trunk/bin/gob-update	Fri Jul 11 08:34:18 2008
@@ -4,9 +4,9 @@
 
 if test $# -lt 1
 then
-	echo "gob-update <branch>"
+	echo "Usage: gob-update <branch>"
 	echo "branch     The 'master' branch"
-	exit 1
+	exit 2
 fi
 
 master_branch=$1
@@ -14,7 +14,7 @@
 gob_bases=$(git-tag | grep '^gob-')
 if test -z "$gob_bases"
 then
-	echo 'cannot find any gob-* tag, aborting'
+	echo 'cannot find any gob-* tag, aborting' 1>&2
 	exit 1
 fi
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]