From: Stefan Haller <stefan@haller-berlin.de>
To: Karl Wiberg <kha@treskal.com>
Cc: git@vger.kernel.org, Paul Mackerras <paulus@samba.org>,
Jonathan Nieder <jrnieder@gmail.com>
Subject: [PATCH] gitk: Add "First parent" checkbox
Date: Thu, 31 Oct 2013 15:59:12 +0100 [thread overview]
Message-ID: <1383231552-63504-1-git-send-email-stefan@haller-berlin.de> (raw)
In-Reply-To: <CAFAOj7orccjudOu4czDpaN-TZBCFb=T-Qo8f9eo_1dnKBGXJ4g@mail.gmail.com>
Sometimes it's desirable to see what changes were introduced by a
merge commit, rather than how conflicts were resolved. This adds
a checkbox which, when turned on, makes gitk show the equivalent
of "git show --first-parent <commit>" for merge commits.
Signed-off-by: Stefan Haller <stefan@haller-berlin.de>
---
This is the same patch as the one I sent in
<http://comments.gmane.org/gmane.comp.version-control.git/160920>, with
the same issues discussed in that thread. I just brought it up to date
with current master.
gitk | 25 ++++++++++++++++++++++---
1 file changed, 22 insertions(+), 3 deletions(-)
diff --git a/gitk b/gitk
index 5cd00d8..3466054 100755
--- a/gitk
+++ b/gitk
@@ -2336,6 +2336,10 @@ proc makewindow {} {
pack .bleft.mid.worddiff -side left -padx 5
}
+ ${NS}::checkbutton .bleft.mid.firstparent -text [mc "First parent"] \
+ -command changefirstparent -variable firstparent
+ pack .bleft.mid.firstparent -side left -padx 5
+
set ctext .bleft.bottom.ctext
text $ctext -background $bgcolor -foreground $fgcolor \
-state disabled -font textfont \
@@ -7080,6 +7084,7 @@ proc selectline {l isnew {desired_loc {}}} {
global cmitmode showneartags allcommits
global targetrow targetid lastscrollrows
global autoselect autosellen jump_to_here
+ global firstparent
catch {unset pending_select}
$canv delete hover
@@ -7221,7 +7226,7 @@ proc selectline {l isnew {desired_loc {}}} {
init_flist [mc "Comments"]
if {$cmitmode eq "tree"} {
gettree $id
- } elseif {[llength $olds] <= 1} {
+ } elseif {[llength $olds] <= 1 || $firstparent} {
startdiff $id
} else {
mergediff $id
@@ -7624,7 +7629,7 @@ proc diffcmd {ids flags} {
proc gettreediffs {ids} {
global treediff treepending limitdiffs vfilelimit curview
- set cmd [diffcmd $ids {--no-commit-id}]
+ set cmd [diffcmd $ids {--no-commit-id -m --first-parent}]
if {$limitdiffs && $vfilelimit($curview) ne {}} {
set cmd [concat $cmd -- $vfilelimit($curview)]
}
@@ -7710,12 +7715,20 @@ proc changeworddiff {name ix op} {
reselectline
}
+proc changefirstparent {} {
+ global treediffs
+ catch {unset treediffs}
+
+ reselectline
+}
+
proc getblobdiffs {ids} {
global blobdifffd diffids env
global diffinhdr treediffs
global diffcontext
global ignorespace
global worddiff
+ global firstparent
global limitdiffs vfilelimit curview
global diffencoding targetline diffnparents
global git_version currdiffsubmod
@@ -7728,13 +7741,18 @@ proc getblobdiffs {ids} {
if {[package vcompare $git_version "1.6.6"] >= 0} {
set submodule "--submodule"
}
- set cmd [diffcmd $ids "-p $textconv $submodule -C --cc --no-commit-id -U$diffcontext"]
+ set cmd [diffcmd $ids "-p $textconv $submodule -C --no-commit-id -U$diffcontext"]
if {$ignorespace} {
append cmd " -w"
}
if {$worddiff ne [mc "Line diff"]} {
append cmd " --word-diff=porcelain"
}
+ if {$firstparent} {
+ append cmd " -m --first-parent"
+ } else {
+ append cmd " --cc"
+ }
if {$limitdiffs && $vfilelimit($curview) ne {}} {
set cmd [concat $cmd -- $vfilelimit($curview)]
}
@@ -11865,6 +11883,7 @@ set diffcontext 3
set mergecolors {red blue green purple brown "#009090" magenta "#808000" "#009000" "#ff0080" cyan "#b07070" "#70b0f0" "#70f0b0" "#f0b070" "#ff70b0"}
set ignorespace 0
set worddiff ""
+set firstparent 0
set markbgcolor "#e0e0ff"
set headbgcolor green
--
1.8.3.2.747.g15edaa9
next prev parent reply other threads:[~2013-10-31 14:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-30 12:39 Show patch in gitk --first-parent ? Karl Wiberg
2013-10-30 14:30 ` Stefan Haller
2013-10-30 17:10 ` Karl Wiberg
2013-10-31 14:59 ` Stefan Haller [this message]
2013-10-30 17:55 ` Andreas Schwab
2013-10-31 10:10 ` Karl Wiberg
-- strict thread matches above, loose matches on Subject: below --
2010-11-08 11:58 [PATCH] gitk: Add "First parent" checkbox Stefan Haller
2010-11-08 10:42 Stefan Haller
2010-11-08 17:24 ` Jonathan Nieder
2010-11-08 19:40 ` Stefan Haller
2010-11-08 19:48 ` Jonathan Nieder
2010-11-08 20:23 ` Stefan Haller
2010-11-08 21:11 ` Jonathan Nieder
2010-11-10 7:17 ` Stefan Haller
2010-12-12 4:27 ` Paul Mackerras
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1383231552-63504-1-git-send-email-stefan@haller-berlin.de \
--to=stefan@haller-berlin.de \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=kha@treskal.com \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).