git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Offer to print changes while running git-mergetool
@ 2009-02-06 14:32 Jonathan del Strother
  2009-02-06 14:41 ` Jonathan del Strother
  2009-02-07  8:11 ` Junio C Hamano
  0 siblings, 2 replies; 10+ messages in thread
From: Jonathan del Strother @ 2009-02-06 14:32 UTC (permalink / raw)
  To: git; +Cc: Jonathan del Strother

Add a "Show changes" option to each prompt in mergetool. This prints the conflicted changes on the current file, using 'git log -p --merge <file>'

Signed-off-by: Jonathan del Strother <jon.delStrother@bestbefore.tv>
---

I frequently find myself running git-mergetool, then finding halfway through that I need to review the changes that produced that conflict.
How about something like this, for showing the changes from within mergetool?

 git-mergetool.sh |   37 ++++++++++++++++++++++++++++++-------
 1 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/git-mergetool.sh b/git-mergetool.sh
index 87fa88a..9df91d8 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -62,7 +62,7 @@ describe_file () {
 
 resolve_symlink_merge () {
     while true; do
-	printf "Use (l)ocal or (r)emote, or (a)bort? "
+	printf "Use (l)ocal or (r)emote, (s)how changes, or (a)bort? "
 	read ans
 	case "$ans" in
 	    [lL]*)
@@ -77,6 +77,12 @@ resolve_symlink_merge () {
 		cleanup_temp_files --save-backup
 		return 0
 		;;
+		[sS]*)
+		git log -p --merge "$MERGED"
+		printf "\n"
+		resolve_symlink_merge
+		return
+		;;
 	    [aA]*)
 		return 1
 		;;
@@ -87,9 +93,9 @@ resolve_symlink_merge () {
 resolve_deleted_merge () {
     while true; do
 	if base_present; then
-	    printf "Use (m)odified or (d)eleted file, or (a)bort? "
+	    printf "Use (m)odified or (d)eleted file, (s)how changes, or (a)bort? "
 	else
-	    printf "Use (c)reated or (d)eleted file, or (a)bort? "
+	    printf "Use (c)reated or (d)eleted file, (s)how changes, or (a)bort? "
 	fi
 	read ans
 	case "$ans" in
@@ -103,6 +109,12 @@ resolve_deleted_merge () {
 		cleanup_temp_files
 		return 0
 		;;
+		[sS]*)
+		git log -p --merge "$MERGED"
+		printf "\n"
+		resolve_deleted_merge
+		return
+		;;
 	    [aA]*)
 		return 1
 		;;
@@ -183,10 +195,21 @@ merge_file () {
     echo "Normal merge conflict for '$MERGED':"
     describe_file "$local_mode" "local" "$LOCAL"
     describe_file "$remote_mode" "remote" "$REMOTE"
-    if "$prompt" = true; then
-	printf "Hit return to start merge resolution tool (%s): " "$merge_tool"
-	read ans
-    fi
+	if "$prompt" = true; then
+		while true; do
+			printf "(S)how changes, or hit return to start merge resolution tool (%s): " "$merge_tool"
+			read ans
+			case "$ans" in
+				[sS]*)
+				git log -p --merge "$MERGED"
+				printf "\n"
+				;;
+				*)
+				break
+				;;
+			esac
+		done
+	fi
 
     case "$merge_tool" in
 	kdiff3)
-- 
1.6.1.2.390.gba743.dirty

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-02-08 12:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-06 14:32 [PATCH] Offer to print changes while running git-mergetool Jonathan del Strother
2009-02-06 14:41 ` Jonathan del Strother
2009-02-06 17:47   ` Junio C Hamano
2009-02-06 19:08     ` Jonathan del Strother
2009-02-07  0:21       ` Junio C Hamano
2009-02-07  8:11 ` Junio C Hamano
2009-02-07 12:01   ` Jonathan del Strother
2009-02-08  1:24     ` Charles Bailey
2009-02-08 11:43       ` Jonathan del Strother
2009-02-08 12:38         ` Charles Bailey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).