From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Haller Subject: [PATCH] gitk: Add "First parent" checkbox Date: Mon, 8 Nov 2010 12:58:14 +0100 Message-ID: <1289217494-69931-1-git-send-email-lists@haller-berlin.de> Cc: git@vger.kernel.org To: Paul Mackerras X-From: git-owner@vger.kernel.org Mon Nov 08 12:58:29 2010 Return-path: Envelope-to: gcvg-git-2@lo.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PFQMk-0003kP-Va for gcvg-git-2@lo.gmane.org; Mon, 08 Nov 2010 12:58:27 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751417Ab0KHL6V (ORCPT ); Mon, 8 Nov 2010 06:58:21 -0500 Received: from mail.ableton.net ([62.96.12.115]:39584 "EHLO mail.ableton.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751222Ab0KHL6V (ORCPT ); Mon, 8 Nov 2010 06:58:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=haller-berlin.de; s=mail_2009081900; h=Message-Id:Date:Subject:Cc:To:From; bh=ksEvXEckm79C0j600Hs8cy+f05hovWzoVIhK1ZwWey4=; b=xAH5WGDx6V7sK4y5NzpUQgRhrWJLbOBuVcwFzLviiwlZgb6wen/GWNWHCvmVgHTgQMi/V+WMqvWjxMBkiDSE8Tyl4R3ewCdt6nW7NDcvd0dsZHqPxttepCOED9/szGOWE1X1GQPMFc4hUzGp9KotnFn9XXqCai7WV43yj1g8row=; Received: from macbook-stk.office.ableton.com ([10.1.12.43]) by mail.ableton.net with esmtpa (Exim 4.72) (envelope-from ) id 1PFQMd-0006F3-VV; Mon, 08 Nov 2010 12:58:20 +0100 X-Mailer: git-send-email 1.7.3.2.153.g8250e Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: 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 " for merge commits. Signed-off-by: Stefan Haller --- I realize this conflicts with Thomas Rast's recent path to add a word-diff dropdown box; things are fighting for space in the diff pane header... gitk | 24 +++++++++++++++++++++--- 1 files changed, 21 insertions(+), 3 deletions(-) diff --git a/gitk b/gitk index 45e3380..db0f022 100755 --- a/gitk +++ b/gitk @@ -2245,6 +2245,9 @@ proc makewindow {} { ${NS}::checkbutton .bleft.mid.ignspace -text [mc "Ignore space change"] \ -command changeignorespace -variable ignorespace pack .bleft.mid.ignspace -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 \ @@ -6872,6 +6875,7 @@ proc selectline {l isnew {desired_loc {}}} { global cmitmode showneartags allcommits global targetrow targetid lastscrollrows global autoselect jump_to_here + global firstparent catch {unset pending_select} $canv delete hover @@ -7013,7 +7017,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 @@ -7416,7 +7420,7 @@ proc diffcmd {ids flags} { proc gettreediffs {ids} { global treediff treepending - if {[catch {set gdtf [open [diffcmd $ids {--no-commit-id}] r]}]} return + if {[catch {set gdtf [open [diffcmd $ids {--no-commit-id -m --first-parent}] r]}]} return set treepending $ids set treediff {} @@ -7504,11 +7508,19 @@ proc changeignorespace {} { reselectline } +proc changefirstparent {} { + global treediffs + catch {unset treediffs} + + reselectline +} + proc getblobdiffs {ids} { global blobdifffd diffids env global diffinhdr treediffs global diffcontext global ignorespace + global firstparent global limitdiffs vfilelimit curview global diffencoding targetline diffnparents global git_version currdiffsubmod @@ -7521,10 +7533,15 @@ 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 {$firstparent} { + append cmd " -m --first-parent" + } else { + append cmd " --cc" + } if {$limitdiffs && $vfilelimit($curview) ne {}} { set cmd [concat $cmd -- $vfilelimit($curview)] } @@ -11393,6 +11410,7 @@ if {[tk windowingsystem] eq "win32"} { set diffcolors {red "#00a000" blue} set diffcontext 3 set ignorespace 0 +set firstparent 0 set markbgcolor "#e0e0ff" set circlecolors {white blue gray blue blue} -- 1.7.3.2.153.g8250e