ooo-build r13391 - in trunk: . bin git



Author: jannieuw
Date: Fri Jul 25 15:09:31 2008
New Revision: 13391
URL: http://svn.gnome.org/viewvc/ooo-build?rev=13391&view=rev

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

	* git/git-svn.perl.diff: New file.  Strip changelog bits.

	* bin/gob-merge: Rename from bin/git-merge-gob.
	* bin/gob-bump:
	* bin/gob-collapse-commits:
	* bin/gob-merge:
	* bin/gob-update:
	* bin/gob: s/git-/git / in anticipation of upstream changes.


Added:
   trunk/bin/gob-merge   (contents, props changed)
   trunk/git/git-svn.perl.diff
Removed:
   trunk/bin/git-merge-gob
Modified:
   trunk/ChangeLog
   trunk/bin/gob
   trunk/bin/gob-bump
   trunk/bin/gob-collapse-commits
   trunk/bin/gob-update

Modified: trunk/bin/gob
==============================================================================
--- trunk/bin/gob	(original)
+++ trunk/bin/gob	Fri Jul 25 15:09:31 2008
@@ -430,13 +430,13 @@
             create_gitignores (dir)
             drink = Setup ().get ('DRINK')
             print >> sys.stderr, 'Creating GIT archive - [ go and have some %(drink)s ] ...' % locals ()
-            self.system ('git-init')
+            self.system ('git init')
             svn_revision = get_svn_revision ()
             self.commit ('Initial svn:r%(svn_revision)s unpatched.' % locals ())
-            self.system ('git-branch %(pristine)s' % self.__dict__)
-            self.system ('git-tag gob-%(workspace)s-%(milestone)s %(pristine)s' % self.__dict__)
-            self.system ('git-branch pristine')
-            self.system ('git-gc')
+            self.system ('git branch %(pristine)s' % self.__dict__)
+            self.system ('git tag gob-%(workspace)s-%(milestone)s %(pristine)s' % self.__dict__)
+            self.system ('git branch pristine')
+            self.system ('git gc')
         if clean:
             if self.is_modified ():
                 self.system ('git reset --hard HEAD')
@@ -444,7 +444,7 @@
         if self.has_branch (self.patched):
             self.checkout (self.patched)
         else:
-            self.system ('git-checkout -b %(patched)s pristine' % self.__dict__)
+            self.system ('git checkout -b %(patched)s pristine' % self.__dict__)
         if self.has_branch (self.scratch):
             self.system ('git branch -D %(scratch)s' % self.__dict__)
     def pipe (self, command, raise_on_error=True):
@@ -455,11 +455,11 @@
         return system ('cd %(dir)s && %(command)s' % locals (), raise_on_error)
     def get_branches (self):
         return filter_out (operator.not_,
-                           self.pipe ('git-branch')
+                           self.pipe ('git branch')
                            .replace ('*', '')
                            .replace (' ', '').split ('\n'))
     def get_log (self, branch=''):
-        return self.pipe ('git-log --pretty=oneline %(branch)s --' % locals ())
+        return self.pipe ('git log --pretty=oneline %(branch)s --' % locals ())
     def current_commit (self, branch=''):
         s = self.get_log ('-1 ' + branch)
         return s[:s.index (' ')]
@@ -475,12 +475,12 @@
             self.commits = dict (map (grok_log_line, log.split ('\n')[:-2]))
         return self.commits.get (patch, None)
     def commit (self, message):
-        self.system ('git-add .')
-        self.system ('git-add -u .')
-        self.system ('''git-commit -m '%(message)s' ''' % locals ())
+        self.system ('git add .')
+        self.system ('git add -u .')
+        self.system ('''git commit -m '%(message)s' ''' % locals ())
     def is_modified (self):
         return re.sub ('# On branch.*\nnothing to commit \(working directory clean\)\n', '',
-                       self.pipe ('git-status', raise_on_error=False))
+                       self.pipe ('git status', raise_on_error=False))
     def assert_clean (self):
         dir = self.dir
         pending = self.is_modified ()
@@ -488,9 +488,9 @@
             raise GitFailed ('working directory unclean: %(dir)s\n%(pending)s' % locals ())
     def checkout (self, branch):
         if not self.is_on_branch (branch):
-            self.system ('git-checkout %(branch)s' % locals ())
+            self.system ('git checkout %(branch)s' % locals ())
     def get_current_branch (self):
-        return re.search ('(^|\n)\* (.+)', self.pipe ('git-branch')).group (2)
+        return re.search ('(^|\n)\* (.+)', self.pipe ('git branch')).group (2)
     def is_on_branch (self, branch):
         return branch == self.get_current_branch ()
     def has_branch (self, branch):
@@ -508,14 +508,14 @@
             dependencies = branch_get_dependencies_with_override (branches, patches, branch)
         if not self.has_branch (branch):
             base_depend = dependencies[0]
-            self.system ('git-checkout -b %(branch)s %(base_depend)s' % locals ())
+            self.system ('git checkout -b %(branch)s %(base_depend)s' % locals ())
             for dependency in dependencies[1:]:
-                self.system ('git-rebase %(dependency)s' % locals ())
+                self.system ('git rebase %(dependency)s' % locals ())
         else:
             self.checkout (branch)
         log = self.get_log (patched)
         commit = log[:log.index (' ')]
-        self.system ('git-cherry-pick -x %(commit)s' % locals ())
+        self.system ('git cherry-pick -x %(commit)s' % locals ())
     def before_ (self):
         self.assert_clean ()
         self.system ('git checkout -b %(scratch)s %(patched)s' % self.__dict__)
@@ -526,7 +526,7 @@
     def pick_patch (self, patch, commit):
         branch = patch_get_branch (patch)
         print >> sys.stderr, 'Picking patch[%(branch)s]:' % locals (), patch.name
-        self.system ('git-cherry-pick -x %(commit)s' % locals ())
+        self.system ('git cherry-pick -x %(commit)s' % locals ())
     def add_patch (self, branches, patches, patch):
         if patch.name in self.get_log ():
             print >> sys.stderr, 'patch already applied, skipping:', patch.name
@@ -720,7 +720,7 @@
         branches = self.get_branches ()
         for patch in self.get_patches ():
             git.add_patch (branches, patches, patch)
-        git.system ('git-gc')
+        git.system ('git gc')
     def get_patches_for_distro (self, distro):
         patches = reduce (operator.add, map (lambda section: section.get_patches (), self.get_sections_for_distro (distro)))
         for patch in patches:
@@ -742,7 +742,7 @@
         git = Git (self.options.build_dir, self.options.patched)
         svn_revision = get_svn_revision ()
         git.commit ('Update to svn:r%(svn_revision)s patched.' % locals ())
-        git.system ('git-rebase patched')
+        git.system ('git rebase patched')
     def dependencies (self):
         '''list branch dependencies'''
         patches = self.get_patches ()
@@ -788,9 +788,9 @@
     def reset (self):
         '''reset - set GIT tree to pristine and remove all branches'''
         git = Git (self.options.build_dir, self.options.patched)
-        git.system ('git-checkout -f %(patched)s' % git.__dict__)
-        git.system ('git-reset --hard pristine')
-        git.system ('''git-branch | grep -Ev '/|master|patched|pristine|upstream|%(patched)s' | xargs git branch -D''' % git.__dict__)
+        git.system ('git checkout -f %(patched)s' % git.__dict__)
+        git.system ('git reset --hard pristine')
+        git.system ('''git branch | grep -Ev '/|master|patched|pristine|upstream|%(patched)s' | xargs git branch -D''' % git.__dict__)
     def patch_depend (self):
         '''patch-depend PATCH-1 PATCH-2 - show overlap between patches'''
         if len (self.options.arguments) != 2:

Modified: trunk/bin/gob-bump
==============================================================================
--- trunk/bin/gob-bump	(original)
+++ trunk/bin/gob-bump	Fri Jul 25 15:09:31 2008
@@ -16,7 +16,7 @@
  TAG        To create the new gob-tag-name tag
 "
 
-. git-sh-setup
+. git sh-setup
 
 function log() { grep -E "^(CONFLICT|Created commit|Merge)" || :; }
 
@@ -64,10 +64,10 @@
 new_tag=gob-$2
 
 # setup
-this_branch=$(git-symbolic-ref HEAD | cut -b 12-)
+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
@@ -75,12 +75,12 @@
 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)
+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"
@@ -95,14 +95,14 @@
 	then
 		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 "Reset tree to state of previous gob tag: $latest_tag." -a 2>&1 | log
-		git-checkout $this_branch
+		git checkout -b $temp_branch $latest_tag
+		git reset --soft $this_branch
+		git commit -m "Reset tree to state of previous gob tag: $latest_tag." -a 2>&1 | log
+		git checkout $this_branch
 		git clean -df > /dev/null 2>&1 | log
-		if git-merge $temp_branch 2>&1 | log
+		if git merge $temp_branch 2>&1 | log
 		then
-			git-branch -d $temp_branch
+			git branch -d $temp_branch
 		else
 			echo "Reverting changes failed." 1>&2
 			exit 1
@@ -111,23 +111,23 @@
 	
 	git checkout $this_branch
 	# get the newest changes and tag the tip
-	git-merge $new_changes 2>&1 | log
-	git-tag $new_tag
+	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
+	git checkout -b $update_branch
 	gob-collapse-commits $latest_tag
-	git-merge $new_changes 2>&1 | log
+	git merge $new_changes 2>&1 | log
 fi
 
 git checkout $update_branch
 # update the branches
 if test -z "$apply_dir"
 then
-	branches="$(git-branch -r | sed 's#^.*origin/##' | grep -Ev '/|^(HEAD|master|patched|pristine)$')"
+	branches="$(git branch -r | sed 's#^.*origin/##' | grep -Ev '/|^(HEAD|master|patched|pristine)$')"
 else
 	# Allow gob-bump to work in multi-distro GIT: work with subset
 	# of [this distro's only] branches
@@ -153,20 +153,20 @@
 	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
+	git checkout -b $temp_branch origin/$branch
 	git branch $temp_update $update_branch
 	if gob-update $temp_update 2>&1 | log
 	then
 		# Let's push later...
-		# git-push
-		git-checkout $temp_update
- 		if git-merge $temp_branch 2>&1 | log
+		# 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
-			git-checkout $temp_branch
-			git-branch -m $temp_branch bumped/$branch
-			git-branch -D $temp_update 2>&1 | log
+			# 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
@@ -181,9 +181,9 @@
 	fi
 done
 
-git-checkout $this_branch
+git checkout $this_branch
 # Do not delete, need for --continue
-# git-branch -D $update_branch 2>&1 | log
+# git branch -D $update_branch 2>&1 | log
 
 # Local Variables:
 # sh-basic-offset:8

Modified: trunk/bin/gob-collapse-commits
==============================================================================
--- trunk/bin/gob-collapse-commits	(original)
+++ trunk/bin/gob-collapse-commits	Fri Jul 25 15:09:31 2008
@@ -23,11 +23,11 @@
 
 (echo gob-collapse-commits $begin_commit..$end_commit;
  echo;
- git-log -1 $begin_commit | tail -n +5;
+ git log -1 $begin_commit | tail -n +5;
  echo '--';
- git-log -1 $end_commit | tail -n +5;) \
+ 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 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
 

Added: trunk/bin/gob-merge
==============================================================================
--- (empty file)
+++ trunk/bin/gob-merge	Fri Jul 25 15:09:31 2008
@@ -0,0 +1,570 @@
+#!/bin/sh
+#
+# Copyright (c) 2005 Junio C Hamano
+#
+
+OPTIONS_KEEPDASHDASH=
+OPTIONS_SPEC="\
+gob-merge [options] <remote>...
+gob-merge [options] <msg> HEAD <remote>
+--
+summary              show a diffstat at the end of the merge
+n,no-summary         don't show a diffstat at the end of the merge
+squash               create a single commit instead of doing a merge
+commit               perform a commit if the merge sucesses (default)
+ff                   allow fast forward (default)
+s,strategy=          merge strategy to use
+m,message=           message to be used for the merge commit (if any)
+b,bases=             restrict merge bases to the these bases only
+"
+
+SUBDIRECTORY_OK=Yes
+. git sh-setup
+require_work_tree
+cd_to_toplevel
+
+test -z "$(git ls-files -u)" ||
+	die "You are in the middle of a conflicted merge."
+
+LF='
+'
+
+all_strategies='recur recursive octopus resolve stupid ours subtree'
+default_twohead_strategies='recursive'
+default_octopus_strategies='octopus'
+no_fast_forward_strategies='subtree ours'
+no_trivial_strategies='recursive recur subtree ours'
+use_strategies=
+
+allow_fast_forward=t
+allow_trivial_merge=t
+squash= no_commit=
+
+dropsave() {
+	rm -f -- "$GIT_DIR/MERGE_HEAD" "$GIT_DIR/MERGE_MSG" \
+		 "$GIT_DIR/MERGE_STASH" || exit 1
+}
+
+savestate() {
+	# Stash away any local modifications.
+	git stash create >"$GIT_DIR/MERGE_STASH"
+}
+
+restorestate() {
+        if test -f "$GIT_DIR/MERGE_STASH"
+	then
+		git reset --hard $head >/dev/null
+		git stash apply $(cat "$GIT_DIR/MERGE_STASH")
+		git update-index --refresh >/dev/null
+	fi
+}
+
+finish_up_to_date () {
+	case "$squash" in
+	t)
+		echo "$1 (nothing to squash)" ;;
+	'')
+		echo "$1" ;;
+	esac
+	dropsave
+}
+
+squash_message () {
+	echo Squashed commit of the following:
+	echo
+	git log --no-merges ^"$head" $remoteheads
+}
+
+finish () {
+	if test '' = "$2"
+	then
+		rlogm="$GIT_REFLOG_ACTION"
+	else
+		echo "$2"
+		rlogm="$GIT_REFLOG_ACTION: $2"
+	fi
+	case "$squash" in
+	t)
+		echo "Squash commit -- not updating HEAD"
+		squash_message >"$GIT_DIR/SQUASH_MSG"
+		;;
+	'')
+		case "$merge_msg" in
+		'')
+			echo "No merge message -- not updating HEAD"
+			;;
+		*)
+			git update-ref -m "$rlogm" HEAD "$1" "$head" || exit 1
+			git gc --auto
+			;;
+		esac
+		;;
+	esac
+	case "$1" in
+	'')
+		;;
+	?*)
+		if test "$show_diffstat" = t
+		then
+			# We want color (if set), but no pager
+			GIT_PAGER='' git diff --stat --summary -M "$head" "$1"
+		fi
+		;;
+	esac
+
+	# Run a post-merge hook
+        if test -x "$GIT_DIR"/hooks/post-merge
+        then
+	    case "$squash" in
+	    t)
+                "$GIT_DIR"/hooks/post-merge 1
+		;;
+	    '')
+                "$GIT_DIR"/hooks/post-merge 0
+		;;
+	    esac
+        fi
+}
+
+merge_name () {
+	remote="$1"
+	rh=$(git rev-parse --verify "$remote^0" 2>/dev/null) || return
+	bh=$(git show-ref -s --verify "refs/heads/$remote" 2>/dev/null)
+	if test "$rh" = "$bh"
+	then
+		echo "$rh		branch '$remote' of ."
+	elif truname=$(expr "$remote" : '\(.*\)~[1-9][0-9]*$') &&
+		git show-ref -q --verify "refs/heads/$truname" 2>/dev/null
+	then
+		echo "$rh		branch '$truname' (early part) of ."
+	elif test "$remote" = "FETCH_HEAD" -a -r "$GIT_DIR/FETCH_HEAD"
+	then
+		sed -e 's/	not-for-merge	/		/' -e 1q \
+			"$GIT_DIR/FETCH_HEAD"
+	else
+		echo "$rh		commit '$remote'"
+	fi
+}
+
+parse_config () {
+	while test $# != 0; do
+		case "$1" in
+		-n|--no-summary)
+			show_diffstat=false ;;
+		--summary)
+			show_diffstat=t ;;
+		--squash)
+			test "$allow_fast_forward" = t ||
+				die "You cannot combine --squash with --no-ff."
+			squash=t no_commit=t ;;
+		--no-squash)
+			squash= no_commit= ;;
+		--commit)
+			no_commit= ;;
+		--no-commit)
+			no_commit=t ;;
+		--ff)
+			allow_fast_forward=t ;;
+		--no-ff)
+			test "$squash" != t ||
+				die "You cannot combine --squash with --no-ff."
+			allow_fast_forward=f ;;
+		-s|--strategy)
+			shift
+			case " $all_strategies " in
+			*" $1 "*)
+				use_strategies="$use_strategies$1 " ;;
+			*)
+				die "available strategies are: $all_strategies" ;;
+			esac
+			;;
+		-m|--message)
+			shift
+			merge_msg="$1"
+			have_message=t
+			;;
+		-b|--bases)
+			shift
+			restrict_to_bases="$1"
+			have_restricted_bases=t
+			;;
+		--)
+			shift
+			break ;;
+		*)	usage ;;
+		esac
+		shift
+	done
+	args_left=$#
+}
+
+test $# != 0 || usage
+
+have_message=
+
+if branch=$(git symbolic-ref -q HEAD)
+then
+	mergeopts=$(git config "branch.${branch#refs/heads/}.mergeoptions")
+	if test -n "$mergeopts"
+	then
+		parse_config $mergeopts --
+	fi
+fi
+
+parse_config "$@"
+while test $args_left -lt $#; do shift; done
+
+if test -z "$show_diffstat"; then
+    test "$(git config --bool merge.diffstat)" = false && show_diffstat=false
+    test -z "$show_diffstat" && show_diffstat=t
+fi
+
+# This could be traditional "merge <msg> HEAD <commit>..."  and the
+# way we can tell it is to see if the second token is HEAD, but some
+# people might have misused the interface and used a committish that
+# is the same as HEAD there instead.  Traditional format never would
+# have "-m" so it is an additional safety measure to check for it.
+
+if test -z "$have_message" &&
+	second_token=$(git rev-parse --verify "$2^0" 2>/dev/null) &&
+	head_commit=$(git rev-parse --verify "HEAD" 2>/dev/null) &&
+	test "$second_token" = "$head_commit"
+then
+	merge_msg="$1"
+	shift
+	head_arg="$1"
+	shift
+elif ! git rev-parse --verify HEAD >/dev/null 2>&1
+then
+	# If the merged head is a valid one there is no reason to
+	# forbid "git merge" into a branch yet to be born.  We do
+	# the same for "git pull".
+	if test 1 -ne $#
+	then
+		echo >&2 "Can merge only exactly one commit into empty head"
+		exit 1
+	fi
+
+	rh=$(git rev-parse --verify "$1^0") ||
+		die "$1 - not something we can merge"
+
+	git update-ref -m "initial pull" HEAD "$rh" "" &&
+	git read-tree --reset -u HEAD
+	exit
+
+else
+	# We are invoked directly as the first-class UI.
+	head_arg=HEAD
+
+	# All the rest are the commits being merged; prepare
+	# the standard merge summary message to be appended to
+	# the given message.  If remote is invalid we will die
+	# later in the common codepath so we discard the error
+	# in this loop.
+	merge_name=$(for remote
+		do
+			merge_name "$remote"
+		done | git fmt-merge-msg
+	)
+	merge_msg="${merge_msg:+$merge_msg$LF$LF}$merge_name"
+fi
+head=$(git rev-parse --verify "$head_arg"^0) || usage
+
+# All the rest are remote heads
+test "$#" = 0 && usage ;# we need at least one remote head.
+set_reflog_action "merge $*"
+
+remoteheads=
+for remote
+do
+	remotehead=$(git rev-parse --verify "$remote"^0 2>/dev/null) ||
+	    die "$remote - not something we can merge"
+	remoteheads="${remoteheads}$remotehead "
+	eval GITHEAD_$remotehead='"$remote"'
+	export GITHEAD_$remotehead
+done
+set x $remoteheads ; shift
+
+case "$use_strategies" in
+'')
+	case "$#" in
+	1)
+		var="`git config --get pull.twohead`"
+		if test -n "$var"
+		then
+			use_strategies="$var"
+		else
+			use_strategies="$default_twohead_strategies"
+		fi ;;
+	*)
+		var="`git config --get pull.octopus`"
+		if test -n "$var"
+		then
+			use_strategies="$var"
+		else
+			use_strategies="$default_octopus_strategies"
+		fi ;;
+	esac
+	;;
+esac
+
+for s in $use_strategies
+do
+	for ss in $no_fast_forward_strategies
+	do
+		case " $s " in
+		*" $ss "*)
+			allow_fast_forward=f
+			break
+			;;
+		esac
+	done
+	for ss in $no_trivial_strategies
+	do
+		case " $s " in
+		*" $ss "*)
+			allow_trivial_merge=f
+			break
+			;;
+		esac
+	done
+done
+
+case "$#" in
+1)
+	common=$(git merge-base --all $head "$@")
+	;;
+*)
+	common=$(git show-branch --merge-base $head "$@")
+	;;
+esac
+
+if test "$have_restricted_bases" = t
+then
+	restrict=$(git rev-parse $restrict_to_bases)
+	old_common=$common
+	common=
+	for b in $old_common
+	do
+		if echo "$restrict" | grep $b >/dev/null 2>/dev/null
+		then
+			common="$common $b"
+		fi
+	done
+fi
+
+echo "$head" >"$GIT_DIR/ORIG_HEAD"
+
+case "$allow_fast_forward,$#,$common,$no_commit" in
+?,*,'',*)
+	# No common ancestors found. We need a real merge.
+	;;
+?,1,"$1",*)
+	# If head can reach all the merge then we are up to date.
+	# but first the most common case of merging one remote.
+	finish_up_to_date "Already up-to-date."
+	exit 0
+	;;
+t,1,"$head",*)
+	# Again the most common case of merging one remote.
+	echo "Updating $(git rev-parse --short $head)..$(git rev-parse --short $1)"
+	git update-index --refresh 2>/dev/null
+	msg="Fast forward"
+	if test -n "$have_message"
+	then
+		msg="$msg (no commit created; -m option ignored)"
+	fi
+	new_head=$(git rev-parse --verify "$1^0") &&
+	git read-tree -v -m -u --exclude-per-directory=.gitignore $head "$new_head" &&
+	finish "$new_head" "$msg" || exit
+	dropsave
+	exit 0
+	;;
+?,1,?*"$LF"?*,*)
+	# We are not doing octopus and not fast forward.  Need a
+	# real merge.
+	;;
+?,1,*,)
+	# We are not doing octopus, not fast forward, and have only
+	# one common.
+	git update-index --refresh 2>/dev/null
+	case "$allow_trivial_merge" in
+	t)
+		# See if it is really trivial.
+		git var GIT_COMMITTER_IDENT >/dev/null || exit
+		echo "Trying really trivial in-index merge..."
+		if git read-tree --trivial -m -u -v $common $head "$1" &&
+		   result_tree=$(git write-tree)
+		then
+			echo "Wonderful."
+			result_commit=$(
+				printf '%s\n' "$merge_msg" |
+				git commit-tree $result_tree -p HEAD -p "$1"
+			) || exit
+			finish "$result_commit" "In-index merge"
+			dropsave
+			exit 0
+		fi
+		echo "Nope."
+	esac
+	;;
+*)
+	# An octopus.  If we can reach all the remote we are up to date.
+	up_to_date=t
+	for remote
+	do
+		common_one=$(git merge-base --all $head $remote)
+		if test "$common_one" != "$remote"
+		then
+			up_to_date=f
+			break
+		fi
+	done
+	if test "$up_to_date" = t
+	then
+		finish_up_to_date "Already up-to-date. Yeeah!"
+		exit 0
+	fi
+	;;
+esac
+
+# We are going to make a new commit.
+git var GIT_COMMITTER_IDENT >/dev/null || exit
+
+# At this point, we need a real merge.  No matter what strategy
+# we use, it would operate on the index, possibly affecting the
+# working tree, and when resolved cleanly, have the desired tree
+# in the index -- this means that the index must be in sync with
+# the $head commit.  The strategies are responsible to ensure this.
+
+case "$use_strategies" in
+?*' '?*)
+    # Stash away the local changes so that we can try more than one.
+    savestate
+    single_strategy=no
+    ;;
+*)
+    rm -f "$GIT_DIR/MERGE_STASH"
+    single_strategy=yes
+    ;;
+esac
+
+result_tree= best_cnt=-1 best_strategy= wt_strategy=
+merge_was_ok=
+for strategy in $use_strategies
+do
+    test "$wt_strategy" = '' || {
+	echo "Rewinding the tree to pristine..."
+	restorestate
+    }
+    case "$single_strategy" in
+    no)
+	echo "Trying merge strategy $strategy..."
+	;;
+    esac
+
+    # Remember which strategy left the state in the working tree
+    wt_strategy=$strategy
+
+    git merge-$strategy $common -- "$head_arg" "$@"
+    exit=$?
+    if test "$no_commit" = t && test "$exit" = 0
+    then
+        merge_was_ok=t
+	exit=1 ;# pretend it left conflicts.
+    fi
+
+    test "$exit" = 0 || {
+
+	# The backend exits with 1 when conflicts are left to be resolved,
+	# with 2 when it does not handle the given merge at all.
+
+	if test "$exit" -eq 1
+	then
+	    cnt=`{
+		git diff-files --name-only
+		git ls-files --unmerged
+	    } | wc -l`
+	    if test $best_cnt -le 0 -o $cnt -le $best_cnt
+	    then
+		best_strategy=$strategy
+		best_cnt=$cnt
+	    fi
+	fi
+	continue
+    }
+
+    # Automerge succeeded.
+    result_tree=$(git write-tree) && break
+done
+
+# If we have a resulting tree, that means the strategy module
+# auto resolved the merge cleanly.
+if test '' != "$result_tree"
+then
+    if test "$allow_fast_forward" = "t"
+    then
+        parents=$(git show-branch --independent "$head" "$@")
+    else
+        parents=$(git rev-parse "$head" "$@")
+    fi
+    parents=$(echo "$parents" | sed -e 's/^/-p /')
+    result_commit=$(printf '%s\n' "$merge_msg" | git commit-tree $result_tree $parents) || exit
+    finish "$result_commit" "Merge made by $wt_strategy."
+    dropsave
+    exit 0
+fi
+
+# Pick the result from the best strategy and have the user fix it up.
+case "$best_strategy" in
+'')
+	restorestate
+	case "$use_strategies" in
+	?*' '?*)
+		echo >&2 "No merge strategy handled the merge."
+		;;
+	*)
+		echo >&2 "Merge with strategy $use_strategies failed."
+		;;
+	esac
+	exit 2
+	;;
+"$wt_strategy")
+	# We already have its result in the working tree.
+	;;
+*)
+	echo "Rewinding the tree to pristine..."
+	restorestate
+	echo "Using the $best_strategy to prepare resolving by hand."
+	git merge-$best_strategy $common -- "$head_arg" "$@"
+	;;
+esac
+
+if test "$squash" = t
+then
+	finish
+else
+	for remote
+	do
+		echo $remote
+	done >"$GIT_DIR/MERGE_HEAD"
+	printf '%s\n' "$merge_msg" >"$GIT_DIR/MERGE_MSG"
+fi
+
+if test "$merge_was_ok" = t
+then
+	echo >&2 \
+	"Automatic merge went well; stopped before committing as requested"
+	exit 0
+else
+	{
+	    echo '
+Conflicts:
+'
+		git ls-files --unmerged |
+		sed -e 's/^[^	]*	/	/' |
+		uniq
+	} >>"$GIT_DIR/MERGE_MSG"
+	git rerere
+	die "Automatic merge failed; fix conflicts and then commit the result."
+fi

Modified: trunk/bin/gob-update
==============================================================================
--- trunk/bin/gob-update	(original)
+++ trunk/bin/gob-update	Fri Jul 25 15:09:31 2008
@@ -11,14 +11,14 @@
 
 master_branch=$1
 
-gob_bases=$(git-tag | grep '^gob-')
+gob_bases=$(git tag | grep '^gob-')
 if test -z "$gob_bases"
 then
 	echo 'cannot find any gob-* tag, aborting' 1>&2
 	exit 1
 fi
 
-git-merge-gob --bases="$gob_bases" $master_branch
+gob-merge --bases="$gob_bases" $master_branch
 
 # Local Variables:
 # sh-basic-offset:8

Added: trunk/git/git-svn.perl.diff
==============================================================================
--- (empty file)
+++ trunk/git/git-svn.perl.diff	Fri Jul 25 15:09:31 2008
@@ -0,0 +1,54 @@
+From f3148bd5b237c90d55e0f85642730011384c55ad Mon Sep 17 00:00:00 2001
+From: Jan Nieuwenhuizen <janneke gnu org>
+Date: Fri, 25 Jul 2008 16:05:38 +0200
+Subject: [PATCH] git-svn.perl: strip ChangeLog bits.
+
+---
+ git-svn.perl |   14 +++++++++++++-
+ 1 files changed, 13 insertions(+), 1 deletions(-)
+
+diff --git a/git-svn.perl b/git-svn.perl
+index 2e0e552..c7ee218 100755
+--- a/git-svn.perl
++++ b/git-svn.perl
+@@ -66,7 +66,7 @@ my ($_stdin, $_help, $_edit,
+ 	$_version, $_fetch_all, $_no_rebase,
+ 	$_merge, $_strategy, $_dry_run, $_local,
+ 	$_prefix, $_no_checkout, $_url, $_verbose,
+-	$_git_format);
++	$_git_format, $_cut_changelog_bits);
+ $Git::SVN::_follow_parent = 1;
+ my %remote_opts = ( 'username=s' => \$Git::SVN::Prompt::_username,
+                     'config-dir=s' => \$Git::SVN::Ra::config_dir,
+@@ -109,9 +109,11 @@ my %cmd = (
+ 	fetch => [ \&cmd_fetch, "Download new revisions from SVN",
+ 			{ 'revision|r=s' => \$_revision,
+ 			  'fetch-all|all' => \$_fetch_all,
++			  'cut-changelog-bits' => \$_cut_changelog_bits,
+ 			   %fc_opts } ],
+ 	clone => [ \&cmd_clone, "Initialize and fetch revisions",
+ 			{ 'revision|r=s' => \$_revision,
++			  'cut-changelog-bits' => \$_cut_changelog_bits,
+ 			   %fc_opts, %init_opts } ],
+ 	init => [ \&cmd_init, "Initialize a repo for tracking" .
+ 			  " (requires URL argument)",
+@@ -2463,6 +2465,16 @@ sub make_log_entry {
+ 	close $un or croak $!;
+ 
+ 	$log_entry{date} = parse_svn_date($log_entry{date});
++	if (defined $_cut_changelog_bits) {
++	    $log_entry{log} =~ s/^(\s*(199|200)}[0-9](-[0-9]{2}){2}\s+.*<.*>\n\s+)//;
++	    $log_entry{log} =~ s/(^|\n)\s*/$1/g;
++	    $log_entry{log} =~ s/(^|\n)\* /\n$1/g;
++            # $log_entry{log} =~ s/(^|\n)\* [^ \t():]+\s*(\([^)]+\)([, \t\n]*))*\s*:\s*/$1\n/g;
++            # $log_entry{log} =~ s/(^|\n)\t/$1/g;
++	    $log_entry{log} =~ s/^[\n\s]*//;
++	    $log_entry{log} =~ s/\n\s*/ /g if length ($log_entry{log}) < 81;
++	    $log_entry{log} .= "\n";
++	}
+ 	$log_entry{log} .= "\n";
+ 	my $author = $log_entry{author} = check_author($log_entry{author});
+ 	my ($name, $email) = defined $::users{$author} ? @{$::users{$author}}
+-- 
+1.5.6.3.317.g5d44c9.dirty
+



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