Skip to content

Commit d4f6bc8

Browse files
committed
Merge git://git.kernel.org/pub/scm/gitk/gitk
* git://git.kernel.org/pub/scm/gitk/gitk: gitk: Allow diff view without context lines gitk: Add another string to translation gitk: Add option 'Simple history' to the options menu gitk: Handle msysGit version during version comparisons gitk: Make more options easily accessible from Edit View dialog gitk: Check git version before using --textconv flag gitk: Use --textconv to generate diff text gitk: Update German translation.
2 parents da4e4a6 + a41ddbb commit d4f6bc8

File tree

2 files changed

+479
-348
lines changed

2 files changed

+479
-348
lines changed

gitk-git/gitk

Lines changed: 106 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ proc parseviewargs {n arglist} {
187187
"--until=*" - "--before=*" - "--max-age=*" - "--min-age=*" -
188188
"--author=*" - "--committer=*" - "--grep=*" - "-[iE]" -
189189
"--remove-empty" - "--first-parent" - "--cherry-pick" -
190-
"-S*" - "--pickaxe-all" - "--pickaxe-regex" {
190+
"-S*" - "--pickaxe-all" - "--pickaxe-regex" -
191+
"--simplify-by-decoration" {
191192
# These mean that we get a subset of the commits
192193
set filtered 1
193194
lappend glflags $arg
@@ -2145,7 +2146,7 @@ proc makewindow {} {
21452146
label .bleft.mid.labeldiffcontext -text " [mc "Lines of context"]: "
21462147
pack .bleft.mid.diff .bleft.mid.old .bleft.mid.new -side left
21472148
spinbox .bleft.mid.diffcontext -width 5 -font textfont \
2148-
-from 1 -increment 1 -to 10000000 \
2149+
-from 0 -increment 1 -to 10000000 \
21492150
-validate all -validatecommand "diffcontextvalidate %P" \
21502151
-textvariable diffcontextstring
21512152
.bleft.mid.diffcontext set $diffcontext
@@ -3671,17 +3672,36 @@ proc newview {ishighlight} {
36713672
}
36723673

36733674
set known_view_options {
3674-
{perm b . {} {mc "Remember this view"}}
3675-
{args t50= + {} {mc "Commits to include (arguments to git log):"}}
3676-
{all b * "--all" {mc "Use all refs"}}
3677-
{dorder b . {"--date-order" "-d"} {mc "Strictly sort by date"}}
3678-
{lright b . "--left-right" {mc "Mark branch sides"}}
3679-
{since t15 + {"--since=*" "--after=*"} {mc "Since date:"}}
3680-
{until t15 . {"--until=*" "--before=*"} {mc "Until date:"}}
3681-
{limit t10 + "--max-count=*" {mc "Max count:"}}
3682-
{skip t10 . "--skip=*" {mc "Skip:"}}
3683-
{first b . "--first-parent" {mc "Limit to first parent"}}
3684-
{cmd t50= + {} {mc "Command to generate more commits to include:"}}
3675+
{perm b . {} {mc "Remember this view"}}
3676+
{reflabel l + {} {mc "References (space separated list):"}}
3677+
{refs t15 .. {} {mc "Branches & tags:"}}
3678+
{allrefs b *. "--all" {mc "All refs"}}
3679+
{branches b . "--branches" {mc "All (local) branches"}}
3680+
{tags b . "--tags" {mc "All tags"}}
3681+
{remotes b . "--remotes" {mc "All remote-tracking branches"}}
3682+
{commitlbl l + {} {mc "Commit Info (regular expressions):"}}
3683+
{author t15 .. "--author=*" {mc "Author:"}}
3684+
{committer t15 . "--committer=*" {mc "Committer:"}}
3685+
{loginfo t15 .. "--grep=*" {mc "Commit Message:"}}
3686+
{allmatch b .. "--all-match" {mc "Matches all Commit Info criteria"}}
3687+
{changes_l l + {} {mc "Changes to Files:"}}
3688+
{pickaxe_s r0 . {} {mc "Fixed String"}}
3689+
{pickaxe_t r1 . "--pickaxe-regex" {mc "Regular Expression"}}
3690+
{pickaxe t15 .. "-S*" {mc "Search string:"}}
3691+
{datelabel l + {} {mc "Commit Dates (\"2 weeks ago\", \"2009-03-17 15:27:38\", \"March 17, 2009 15:27:38\"):"}}
3692+
{since t15 .. {"--since=*" "--after=*"} {mc "Since:"}}
3693+
{until t15 . {"--until=*" "--before=*"} {mc "Until:"}}
3694+
{limit_lbl l + {} {mc "Limit and/or skip a number of revisions (positive integer):"}}
3695+
{limit t10 *. "--max-count=*" {mc "Number to show:"}}
3696+
{skip t10 . "--skip=*" {mc "Number to skip:"}}
3697+
{misc_lbl l + {} {mc "Miscellaneous options:"}}
3698+
{dorder b *. {"--date-order" "-d"} {mc "Strictly sort by date"}}
3699+
{lright b . "--left-right" {mc "Mark branch sides"}}
3700+
{first b . "--first-parent" {mc "Limit to first parent"}}
3701+
{smplhst b . "--simplify-by-decoration" {mc "Simple history"}}
3702+
{args t50 *. {} {mc "Additional arguments to git log:"}}
3703+
{allpaths path + {} {mc "Enter files and directories to include, one per line:"}}
3704+
{cmd t50= + {} {mc "Command to generate more commits to include:"}}
36853705
}
36863706

36873707
proc encode_view_opts {n} {
@@ -3693,35 +3713,50 @@ proc encode_view_opts {n} {
36933713
if {$patterns eq {}} continue
36943714
set pattern [lindex $patterns 0]
36953715

3696-
set val $newviewopts($n,[lindex $opt 0])
3697-
36983716
if {[lindex $opt 1] eq "b"} {
3717+
set val $newviewopts($n,[lindex $opt 0])
36993718
if {$val} {
37003719
lappend rargs $pattern
37013720
}
3721+
} elseif {[regexp {^r(\d+)$} [lindex $opt 1] type value]} {
3722+
regexp {^(.*_)} [lindex $opt 0] uselessvar button_id
3723+
set val $newviewopts($n,$button_id)
3724+
if {$val eq $value} {
3725+
lappend rargs $pattern
3726+
}
37023727
} else {
3728+
set val $newviewopts($n,[lindex $opt 0])
37033729
set val [string trim $val]
37043730
if {$val ne {}} {
37053731
set pfix [string range $pattern 0 end-1]
37063732
lappend rargs $pfix$val
37073733
}
37083734
}
37093735
}
3736+
set rargs [concat $rargs [shellsplit $newviewopts($n,refs)]]
37103737
return [concat $rargs [shellsplit $newviewopts($n,args)]]
37113738
}
37123739

37133740
proc decode_view_opts {n view_args} {
37143741
global known_view_options newviewopts
37153742

37163743
foreach opt $known_view_options {
3744+
set id [lindex $opt 0]
37173745
if {[lindex $opt 1] eq "b"} {
3746+
# Checkboxes
3747+
set val 0
3748+
} elseif {[regexp {^r(\d+)$} [lindex $opt 1]]} {
3749+
# Radiobuttons
3750+
regexp {^(.*_)} $id uselessvar id
37183751
set val 0
37193752
} else {
3753+
# Text fields
37203754
set val {}
37213755
}
3722-
set newviewopts($n,[lindex $opt 0]) $val
3756+
set newviewopts($n,$id) $val
37233757
}
37243758
set oargs [list]
3759+
set refargs [list]
37253760
foreach arg $view_args {
37263761
if {[regexp -- {^-([0-9]+)$} $arg arg cnt]
37273762
&& ![info exists found(limit)]} {
@@ -3735,11 +3770,17 @@ proc decode_view_opts {n view_args} {
37353770
if {[info exists found($id)]} continue
37363771
foreach pattern [lindex $opt 3] {
37373772
if {![string match $pattern $arg]} continue
3738-
if {[lindex $opt 1] ne "b"} {
3773+
if {[lindex $opt 1] eq "b"} {
3774+
# Check buttons
3775+
set val 1
3776+
} elseif {[regexp {^r(\d+)$} [lindex $opt 1] match num]} {
3777+
# Radio buttons
3778+
regexp {^(.*_)} $id uselessvar id
3779+
set val $num
3780+
} else {
3781+
# Text input fields
37393782
set size [string length $pattern]
37403783
set val [string range $arg [expr {$size-1}] end]
3741-
} else {
3742-
set val 1
37433784
}
37443785
set newviewopts($n,$id) $val
37453786
set found($id) 1
@@ -3748,8 +3789,13 @@ proc decode_view_opts {n view_args} {
37483789
if {[info exists val]} break
37493790
}
37503791
if {[info exists val]} continue
3751-
lappend oargs $arg
3792+
if {[regexp {^-} $arg]} {
3793+
lappend oargs $arg
3794+
} else {
3795+
lappend refargs $arg
3796+
}
37523797
}
3798+
set newviewopts($n,refs) [shellarglist $refargs]
37533799
set newviewopts($n,args) [shellarglist $oargs]
37543800
}
37553801

@@ -3785,16 +3831,16 @@ proc vieweditor {top n title} {
37853831
global known_view_options
37863832

37873833
toplevel $top
3788-
wm title $top $title
3834+
wm title $top [concat $title [mc "-- criteria for selecting revisions"]]
37893835
make_transient $top .
37903836

37913837
# View name
37923838
frame $top.nfr
3793-
label $top.nl -text [mc "Name"]
3839+
label $top.nl -text [mc "View Name:"]
37943840
entry $top.name -width 20 -textvariable newviewname($n)
37953841
pack $top.nfr -in $top -fill x -pady 5 -padx 3
3796-
pack $top.nl -in $top.nfr -side left -padx {0 30}
3797-
pack $top.name -in $top.nfr -side left
3842+
pack $top.nl -in $top.nfr -side left -padx {0 5}
3843+
pack $top.name -in $top.nfr -side left -padx {0 25}
37983844

37993845
# View options
38003846
set cframe $top.nfr
@@ -3813,14 +3859,28 @@ proc vieweditor {top n title} {
38133859
frame $cframe
38143860
pack $cframe -in $top -fill x -pady 3 -padx 3
38153861
set cexpand [expr {$flags eq "*"}]
3862+
} elseif {$flags eq ".." || $flags eq "*."} {
3863+
set cframe $top.fr$cnt
3864+
incr cnt
3865+
frame $cframe
3866+
pack $cframe -in $top -fill x -pady 3 -padx [list 15 3]
3867+
set cexpand [expr {$flags eq "*."}]
38163868
} else {
38173869
set lxpad 5
38183870
}
38193871

3820-
if {$type eq "b"} {
3872+
if {$type eq "l"} {
3873+
label $cframe.l_$id -text $title
3874+
pack $cframe.l_$id -in $cframe -side left -pady [list 3 0] -anchor w
3875+
} elseif {$type eq "b"} {
38213876
checkbutton $cframe.c_$id -text $title -variable newviewopts($n,$id)
38223877
pack $cframe.c_$id -in $cframe -side left \
38233878
-padx [list $lxpad 0] -expand $cexpand -anchor w
3879+
} elseif {[regexp {^r(\d+)$} $type type sz]} {
3880+
regexp {^(.*_)} $id uselessvar button_id
3881+
radiobutton $cframe.c_$id -text $title -variable newviewopts($n,$button_id) -value $sz
3882+
pack $cframe.c_$id -in $cframe -side left \
3883+
-padx [list $lxpad 0] -expand $cexpand -anchor w
38243884
} elseif {[regexp {^t(\d+)$} $type type sz]} {
38253885
message $cframe.l_$id -aspect 1500 -text $title
38263886
entry $cframe.e_$id -width $sz -background $bgcolor \
@@ -3833,23 +3893,22 @@ proc vieweditor {top n title} {
38333893
-textvariable newviewopts($n,$id)
38343894
pack $cframe.l_$id -in $cframe -side top -pady [list 3 0] -anchor w
38353895
pack $cframe.e_$id -in $cframe -side top -fill x
3896+
} elseif {$type eq "path"} {
3897+
message $top.l -aspect 1500 -text $title
3898+
pack $top.l -in $top -side top -pady [list 3 0] -anchor w -padx 3
3899+
text $top.t -width 40 -height 5 -background $bgcolor -font uifont
3900+
if {[info exists viewfiles($n)]} {
3901+
foreach f $viewfiles($n) {
3902+
$top.t insert end $f
3903+
$top.t insert end "\n"
3904+
}
3905+
$top.t delete {end - 1c} end
3906+
$top.t mark set insert 0.0
3907+
}
3908+
pack $top.t -in $top -side top -pady [list 0 5] -fill both -expand 1 -padx 3
38363909
}
38373910
}
38383911

3839-
# Path list
3840-
message $top.l -aspect 1500 \
3841-
-text [mc "Enter files and directories to include, one per line:"]
3842-
pack $top.l -in $top -side top -pady [list 7 0] -anchor w -padx 3
3843-
text $top.t -width 40 -height 5 -background $bgcolor -font uifont
3844-
if {[info exists viewfiles($n)]} {
3845-
foreach f $viewfiles($n) {
3846-
$top.t insert end $f
3847-
$top.t insert end "\n"
3848-
}
3849-
$top.t delete {end - 1c} end
3850-
$top.t mark set insert 0.0
3851-
}
3852-
pack $top.t -in $top -side top -pady [list 0 5] -fill both -expand 1 -padx 3
38533912
frame $top.buts
38543913
button $top.buts.ok -text [mc "OK"] -command [list newviewok $top $n]
38553914
button $top.buts.apply -text [mc "Apply (F5)"] -command [list newviewok $top $n 1]
@@ -7249,7 +7308,7 @@ proc diffcontextchange {n1 n2 op} {
72497308
global diffcontextstring diffcontext
72507309

72517310
if {[string is integer -strict $diffcontextstring]} {
7252-
if {$diffcontextstring > 0} {
7311+
if {$diffcontextstring >= 0} {
72537312
set diffcontext $diffcontextstring
72547313
reselectline
72557314
}
@@ -7267,8 +7326,13 @@ proc getblobdiffs {ids} {
72677326
global ignorespace
72687327
global limitdiffs vfilelimit curview
72697328
global diffencoding targetline diffnparents
7329+
global git_version
72707330

7271-
set cmd [diffcmd $ids "-p -C --cc --no-commit-id -U$diffcontext"]
7331+
set textconv {}
7332+
if {[package vcompare $git_version "1.6.1"] >= 0} {
7333+
set textconv "--textconv"
7334+
}
7335+
set cmd [diffcmd $ids "-p $textconv -C --cc --no-commit-id -U$diffcontext"]
72727336
if {$ignorespace} {
72737337
append cmd " -w"
72747338
}
@@ -11090,6 +11154,7 @@ set nullid2 "0000000000000000000000000000000000000001"
1109011154
set nullfile "/dev/null"
1109111155

1109211156
set have_tk85 [expr {[package vcompare $tk_version "8.5"] >= 0}]
11157+
set git_version [join [lrange [split [lindex [exec git version] end] .] 0 2] .]
1109311158

1109411159
set runq {}
1109511160
set history {}

0 commit comments

Comments
 (0)