git-gui 0.21.0

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCAAGBQJYCJqmAAoJEDn3Aot9nM55uKQP/11BTzhOr9K3SLzwCr01ylGP
 94AOA511vx3fIX5aWQ29S96tGbluo73RdbVsWFKKJcKSErpFPscFEiRkyjeMXE2T
 yWWOPOg08tm28ppZNp0Kqjb8VykUUKuG6gVT59DNFUZUqHYQbiQy+t8nwT+Qow3U
 dvo6lksovfSaW2FORWIi5KF5gD4v2F9qsbFgr725a8UoBrOmF0SWaCG4/ZYj0WxF
 0rq8LjpvmMuQqd06DAoGMIsHa71R61En2QWfJ4YoE5+QRq8wQl37FmX+ojiA1rzY
 CG/vJO2Tw4v54wHKK1TCXG7LR4JhTcQZOa6zd8HHsPRn+viGDCMVUG9uMewfxH+m
 F47EVMxiKf0subm3fUhycqkvso0r6mOAddhz47RKT7tqU4XOnhPyGw0x6m7evawg
 Sz2+fOK3wwX2Qec5o3vBZKaEcOftSrLuZmbi5/j43crvcf+OAs9s/jdq/Ulpkks2
 JI2i0DLzHABTbDn6QsuysEZnituks8T8Fdm5NOldritgBNVY81ifatekFscxt6Ct
 OrT9eGJk6iZiX1RvS+R7wykKJCBkxiyHqM8vSj5tPWjApgtnopPMudzNX41geaL9
 ADeb8LVMTTNL/md8KED0deypilcPNnPbW035rAbyCpAsKbtgO3zdfzdzxsQ+dIvc
 MQpCDP5QPPr3toRVdNmb
 =VyhL
 -----END PGP SIGNATURE-----

Merge tag 'gitgui-0.21.0' of git://repo.or.cz/git-gui

git-gui 0.21.0

* tag 'gitgui-0.21.0' of git://repo.or.cz/git-gui: (22 commits)
  git-gui: set version 0.21
  git-gui: Mark 'All' in remote.tcl for translation
  git-gui i18n: Updated Bulgarian translation (565,0f,0u)
  git-gui: avoid persisting modified author identity
  git-gui: handle the encoding of Git's output correctly
  git-gui: unicode file name support on windows
  git-gui: Update Russian translation
  git-gui: maintain backwards compatibility for merge syntax
  git-gui i18n: mark string in lib/error.tcl for translation
  git-gui: fix incorrect use of Tcl append command
  git-gui i18n: mark "usage:" strings for translation
  git-gui i18n: internationalize use of colon punctuation
  git-gui: ensure the file in the diff pane is in the list of selected files
  git-gui: support for $FILENAMES in tool definitions
  git-gui: fix initial git gui message encoding
  git-gui/po/glossary/txt-to-pot.sh: use the $( ... ) construct for command substitution
  git-gui (Windows): use git-gui.exe in `Create Desktop Shortcut`
  git-gui: fix detection of Cygwin
  Amend tab ordering and text widget border and highlighting.
  Allow keyboard control to work in the staging widgets.
  ...
This commit is contained in:
Junio C Hamano 2016-10-20 09:33:17 -07:00
commit 3eae308700
26 changed files with 2068 additions and 2009 deletions

View File

@ -1,7 +1,7 @@
#!/bin/sh
GVF=GIT-VERSION-FILE
DEF_VER=0.20.GITGUI
DEF_VER=0.21.GITGUI
LF='
'

View File

@ -259,7 +259,7 @@ lib/tclIndex: $(ALL_LIBFILES) GIT-GUI-VARS
rm -f $@ ; \
echo '# Autogenerated by git-gui Makefile' >$@ && \
echo >>$@ && \
$(foreach p,$(PRELOAD_FILES) $(ALL_LIBFILES),echo '$(subst lib/,,$p)' >>$@ &&) \
$(foreach p,$(PRELOAD_FILES) $(sort $(ALL_LIBFILES)),echo '$(subst lib/,,$p)' >>$@ &&) \
echo >>$@ ; \
fi

View File

@ -275,6 +275,10 @@ proc is_Cygwin {} {
set _iscygwin 0
} else {
set _iscygwin 1
# Handle MSys2 which is only cygwin when MSYSTEM is MSYS.
if {[info exists ::env(MSYSTEM)] && $::env(MSYSTEM) ne "MSYS"} {
set _iscygwin 0
}
}
} else {
set _iscygwin 0
@ -530,28 +534,10 @@ proc _lappend_nice {cmd_var} {
}
proc git {args} {
set opt [list]
while {1} {
switch -- [lindex $args 0] {
--nice {
_lappend_nice opt
}
default {
break
}
}
set args [lrange $args 1 end]
}
set cmdp [_git_cmd [lindex $args 0]]
set args [lrange $args 1 end]
_trace_exec [concat $opt $cmdp $args]
set result [eval exec $opt $cmdp $args]
set fd [eval [list git_read] $args]
fconfigure $fd -translation binary -encoding utf-8
set result [string trimright [read $fd] "\n"]
close $fd
if {$::_trace} {
puts stderr "< $result"
}
@ -1107,7 +1093,7 @@ git-version proc _parse_config {arr_name args} {
[list git_read config] \
$args \
[list --null --list]]
fconfigure $fd_rc -translation binary
fconfigure $fd_rc -translation binary -encoding utf-8
set buf [read $fd_rc]
close $fd_rc
}
@ -1616,11 +1602,13 @@ proc run_prepare_commit_msg_hook {} {
if {[file isfile [gitdir MERGE_MSG]]} {
set pcm_source "merge"
set fd_mm [open [gitdir MERGE_MSG] r]
fconfigure $fd_mm -encoding utf-8
puts -nonewline $fd_pcm [read $fd_mm]
close $fd_mm
} elseif {[file isfile [gitdir SQUASH_MSG]]} {
set pcm_source "squash"
set fd_sm [open [gitdir SQUASH_MSG] r]
fconfigure $fd_sm -encoding utf-8
puts -nonewline $fd_pcm [read $fd_sm]
close $fd_sm
} else {
@ -1685,7 +1673,7 @@ proc read_diff_index {fd after} {
set i [split [string range $buf_rdi $c [expr {$z1 - 2}]] { }]
set p [string range $buf_rdi $z1 [expr {$z2 - 1}]]
merge_state \
[encoding convertfrom $p] \
[encoding convertfrom utf-8 $p] \
[lindex $i 4]? \
[list [lindex $i 0] [lindex $i 2]] \
[list]
@ -1718,7 +1706,7 @@ proc read_diff_files {fd after} {
set i [split [string range $buf_rdf $c [expr {$z1 - 2}]] { }]
set p [string range $buf_rdf $z1 [expr {$z2 - 1}]]
merge_state \
[encoding convertfrom $p] \
[encoding convertfrom utf-8 $p] \
?[lindex $i 4] \
[list] \
[list [lindex $i 0] [lindex $i 2]]
@ -1741,7 +1729,7 @@ proc read_ls_others {fd after} {
set pck [split $buf_rlo "\0"]
set buf_rlo [lindex $pck end]
foreach p [lrange $pck 0 end-1] {
set p [encoding convertfrom $p]
set p [encoding convertfrom utf-8 $p]
if {[string index $p end] eq {/}} {
set p [string range $p 0 end-1]
}
@ -2505,13 +2493,28 @@ proc force_first_diff {after} {
}
}
proc toggle_or_diff {w x y} {
proc toggle_or_diff {mode w args} {
global file_states file_lists current_diff_path ui_index ui_workdir
global last_clicked selected_paths
set pos [split [$w index @$x,$y] .]
set lno [lindex $pos 0]
set col [lindex $pos 1]
if {$mode eq "click"} {
foreach {x y} $args break
set pos [split [$w index @$x,$y] .]
foreach {lno col} $pos break
} else {
if {$last_clicked ne {}} {
set lno [lindex $last_clicked 1]
} else {
set lno [expr {int([lindex [$w tag ranges in_diff] 0])}]
}
if {$mode eq "toggle"} {
set col 0; set y 2
} else {
incr lno [expr {$mode eq "up" ? -1 : 1}]
set col 1
}
}
set path [lindex $file_lists($w) [expr {$lno - 1}]]
if {$path eq {}} {
set last_clicked {}
@ -2519,6 +2522,7 @@ proc toggle_or_diff {w x y} {
}
set last_clicked [list $w $lno]
focus $w
array unset selected_paths
$ui_index tag remove in_sel 0.0 end
$ui_workdir tag remove in_sel 0.0 end
@ -2598,7 +2602,7 @@ proc add_range_to_selection {w x y} {
global file_lists last_clicked selected_paths
if {[lindex $last_clicked 0] ne $w} {
toggle_or_diff $w $x $y
toggle_or_diff click $w $x $y
return
}
@ -3007,7 +3011,7 @@ bind all <$M1B-Key-W> {destroy [winfo toplevel %W]}
set subcommand_args {}
proc usage {} {
set s "usage: $::argv0 $::subcommand $::subcommand_args"
set s "[mc usage:] $::argv0 $::subcommand $::subcommand_args"
if {[tk windowingsystem] eq "win32"} {
wm withdraw .
tk_messageBox -icon info -message $s \
@ -3139,7 +3143,7 @@ gui {
# fall through to setup UI for commits
}
default {
set err "usage: $argv0 \[{blame|browser|citool}\]"
set err "[mc usage:] $argv0 \[{blame|browser|citool}\]"
if {[tk windowingsystem] eq "win32"} {
wm withdraw .
tk_messageBox -icon error -message $err \
@ -3178,36 +3182,16 @@ if {$use_ttk} {
}
pack .vpane -anchor n -side top -fill both -expand 1
# -- Index File List
#
${NS}::frame .vpane.files.index -height 100 -width 200
tlabel .vpane.files.index.title \
-text [mc "Staged Changes (Will Commit)"] \
-background lightgreen -foreground black
text $ui_index -background white -foreground black \
-borderwidth 0 \
-width 20 -height 10 \
-wrap none \
-cursor $cursor_ptr \
-xscrollcommand {.vpane.files.index.sx set} \
-yscrollcommand {.vpane.files.index.sy set} \
-state disabled
${NS}::scrollbar .vpane.files.index.sx -orient h -command [list $ui_index xview]
${NS}::scrollbar .vpane.files.index.sy -orient v -command [list $ui_index yview]
pack .vpane.files.index.title -side top -fill x
pack .vpane.files.index.sx -side bottom -fill x
pack .vpane.files.index.sy -side right -fill y
pack $ui_index -side left -fill both -expand 1
# -- Working Directory File List
#
${NS}::frame .vpane.files.workdir -height 100 -width 200
textframe .vpane.files.workdir -height 100 -width 200
tlabel .vpane.files.workdir.title -text [mc "Unstaged Changes"] \
-background lightsalmon -foreground black
text $ui_workdir -background white -foreground black \
ttext $ui_workdir -background white -foreground black \
-borderwidth 0 \
-width 20 -height 10 \
-wrap none \
-takefocus 1 -highlightthickness 1\
-cursor $cursor_ptr \
-xscrollcommand {.vpane.files.workdir.sx set} \
-yscrollcommand {.vpane.files.workdir.sy set} \
@ -3219,6 +3203,30 @@ pack .vpane.files.workdir.sx -side bottom -fill x
pack .vpane.files.workdir.sy -side right -fill y
pack $ui_workdir -side left -fill both -expand 1
# -- Index File List
#
textframe .vpane.files.index -height 100 -width 200
tlabel .vpane.files.index.title \
-text [mc "Staged Changes (Will Commit)"] \
-background lightgreen -foreground black
ttext $ui_index -background white -foreground black \
-borderwidth 0 \
-width 20 -height 10 \
-wrap none \
-takefocus 1 -highlightthickness 1\
-cursor $cursor_ptr \
-xscrollcommand {.vpane.files.index.sx set} \
-yscrollcommand {.vpane.files.index.sy set} \
-state disabled
${NS}::scrollbar .vpane.files.index.sx -orient h -command [list $ui_index xview]
${NS}::scrollbar .vpane.files.index.sy -orient v -command [list $ui_index yview]
pack .vpane.files.index.title -side top -fill x
pack .vpane.files.index.sx -side bottom -fill x
pack .vpane.files.index.sy -side right -fill y
pack $ui_index -side left -fill both -expand 1
# -- Insert the workdir and index into the panes
#
.vpane.files add .vpane.files.workdir
.vpane.files add .vpane.files.index
if {!$use_ttk} {
@ -3301,7 +3309,7 @@ if {![is_enabled nocommit]} {
#
${NS}::frame .vpane.lower.commarea.buffer
${NS}::frame .vpane.lower.commarea.buffer.header
set ui_comm .vpane.lower.commarea.buffer.t
set ui_comm .vpane.lower.commarea.buffer.frame.t
set ui_coml .vpane.lower.commarea.buffer.header.l
if {![is_enabled nocommit]} {
@ -3344,20 +3352,25 @@ if {![is_enabled nocommit]} {
pack .vpane.lower.commarea.buffer.header.new -side right
}
text $ui_comm -background white -foreground black \
textframe .vpane.lower.commarea.buffer.frame
ttext $ui_comm -background white -foreground black \
-borderwidth 1 \
-undo true \
-maxundo 20 \
-autoseparators true \
-takefocus 1 \
-highlightthickness 1 \
-relief sunken \
-width $repo_config(gui.commitmsgwidth) -height 9 -wrap none \
-font font_diff \
-yscrollcommand {.vpane.lower.commarea.buffer.sby set}
${NS}::scrollbar .vpane.lower.commarea.buffer.sby \
-yscrollcommand {.vpane.lower.commarea.buffer.frame.sby set}
${NS}::scrollbar .vpane.lower.commarea.buffer.frame.sby \
-command [list $ui_comm yview]
pack .vpane.lower.commarea.buffer.header -side top -fill x
pack .vpane.lower.commarea.buffer.sby -side right -fill y
pack .vpane.lower.commarea.buffer.frame.sby -side right -fill y
pack $ui_comm -side left -fill y
pack .vpane.lower.commarea.buffer.header -side top -fill x
pack .vpane.lower.commarea.buffer.frame -side left -fill y
pack .vpane.lower.commarea.buffer -side left -fill y
# -- Commit Message Buffer Context Menu
@ -3455,12 +3468,13 @@ bind_button3 .vpane.lower.diff.header.path "tk_popup $ctxm %X %Y"
# -- Diff Body
#
${NS}::frame .vpane.lower.diff.body
textframe .vpane.lower.diff.body
set ui_diff .vpane.lower.diff.body.t
text $ui_diff -background white -foreground black \
ttext $ui_diff -background white -foreground black \
-borderwidth 0 \
-width 80 -height 5 -wrap none \
-font font_diff \
-takefocus 1 -highlightthickness 1 \
-xscrollcommand {.vpane.lower.diff.body.sbx set} \
-yscrollcommand {.vpane.lower.diff.body.sby set} \
-state disabled
@ -3815,10 +3829,10 @@ bind . <$M1B-Key-r> ui_do_rescan
bind . <$M1B-Key-R> ui_do_rescan
bind . <$M1B-Key-s> do_signoff
bind . <$M1B-Key-S> do_signoff
bind . <$M1B-Key-t> do_add_selection
bind . <$M1B-Key-T> do_add_selection
bind . <$M1B-Key-u> do_unstage_selection
bind . <$M1B-Key-U> do_unstage_selection
bind . <$M1B-Key-t> { toggle_or_diff toggle %W }
bind . <$M1B-Key-T> { toggle_or_diff toggle %W }
bind . <$M1B-Key-u> { toggle_or_diff toggle %W }
bind . <$M1B-Key-U> { toggle_or_diff toggle %W }
bind . <$M1B-Key-j> do_revert_selection
bind . <$M1B-Key-J> do_revert_selection
bind . <$M1B-Key-i> do_add_all
@ -3830,9 +3844,11 @@ bind . <$M1B-Key-plus> {show_more_context;break}
bind . <$M1B-Key-KP_Add> {show_more_context;break}
bind . <$M1B-Key-Return> do_commit
foreach i [list $ui_index $ui_workdir] {
bind $i <Button-1> "toggle_or_diff $i %x %y; break"
bind $i <$M1B-Button-1> "add_one_to_selection $i %x %y; break"
bind $i <Shift-Button-1> "add_range_to_selection $i %x %y; break"
bind $i <Button-1> { toggle_or_diff click %W %x %y; break }
bind $i <$M1B-Button-1> { add_one_to_selection %W %x %y; break }
bind $i <Shift-Button-1> { add_range_to_selection %W %x %y; break }
bind $i <Key-Up> { toggle_or_diff up %W; break }
bind $i <Key-Down> { toggle_or_diff down %W; break }
}
unset i

View File

@ -70,7 +70,7 @@ constructor new {i_commit i_path i_jump} {
set path $i_path
make_toplevel top w
wm title $top [append "[appname] ([reponame]): " [mc "File Viewer"]]
wm title $top [mc "%s (%s): File Viewer" [appname] [reponame]]
set font_w [font measure font_diff "0"]

View File

@ -13,7 +13,7 @@ constructor dialog {} {
global use_ttk NS
make_dialog top w
wm withdraw $w
wm title $top [append "[appname] ([reponame]): " [mc "Checkout Branch"]]
wm title $top [mc "%s (%s): Checkout Branch" [appname] [reponame]]
if {$top ne {.}} {
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
}

View File

@ -20,7 +20,7 @@ constructor dialog {} {
make_dialog top w
wm withdraw $w
wm title $top [append "[appname] ([reponame]): " [mc "Create Branch"]]
wm title $top [mc "%s (%s): Create Branch" [appname] [reponame]]
if {$top ne {.}} {
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
}

View File

@ -13,7 +13,7 @@ constructor dialog {} {
make_dialog top w
wm withdraw $w
wm title $top [append "[appname] ([reponame]): " [mc "Delete Branch"]]
wm title $top [mc "%s (%s): Delete Branch" [appname] [reponame]]
if {$top ne {.}} {
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
}
@ -128,7 +128,7 @@ method _delete {} {
set b [lindex $i 0]
set o [lindex $i 1]
if {[catch {git branch -D $b} err]} {
append failed " - $b: $err\n"
append failed [mc " - %s:" $b] " $err\n"
}
}

View File

@ -12,7 +12,7 @@ constructor dialog {} {
make_dialog top w
wm withdraw $w
wm title $top [append "[appname] ([reponame]): " [mc "Rename Branch"]]
wm title $top [mc "%s (%s): Rename Branch" [appname] [reponame]]
if {$top ne {.}} {
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
}

View File

@ -24,7 +24,7 @@ constructor new {commit {path {}}} {
global cursor_ptr M1B use_ttk NS
make_dialog top w
wm withdraw $top
wm title $top [append "[appname] ([reponame]): " [mc "File Browser"]]
wm title $top [mc "%s (%s): File Browser" [appname] [reponame]]
if {$path ne {}} {
if {[string index $path end] ne {/}} {
@ -197,7 +197,7 @@ method _ls {tree_id {name {}}} {
$w conf -state disabled
set fd [git_read ls-tree -z $tree_id]
fconfigure $fd -blocking 0 -translation binary -encoding binary
fconfigure $fd -blocking 0 -translation binary -encoding utf-8
fileevent $fd readable [cb _read $fd]
}
@ -272,7 +272,7 @@ constructor dialog {} {
global use_ttk NS
make_dialog top w
wm withdraw $top
wm title $top [append "[appname] ([reponame]): " [mc "Browse Branch Files"]]
wm title $top [mc "%s (%s): Browse Branch Files" [appname] [reponame]]
if {$top ne {.}} {
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
wm transient $top .

View File

@ -2,7 +2,7 @@
# Copyright (C) 2006, 2007 Shawn Pearce
proc load_last_commit {} {
global HEAD PARENT MERGE_HEAD commit_type ui_comm
global HEAD PARENT MERGE_HEAD commit_type ui_comm commit_author
global repo_config
if {[llength $PARENT] == 0} {
@ -34,6 +34,8 @@ You are currently in the middle of a merge that has not been fully completed. Y
lappend parents [string range $line 7 end]
} elseif {[string match {encoding *} $line]} {
set enc [string tolower [string range $line 9 end]]
} elseif {[regexp "author (.*)\\s<(.*)>\\s(\\d.*$)" $line all name email time]} {
set commit_author [list name $name email $email date $time]
}
}
set msg [read $fd]
@ -106,9 +108,10 @@ proc do_signoff {} {
}
proc create_new_commit {} {
global commit_type ui_comm
global commit_type ui_comm commit_author
set commit_type normal
unset -nocomplain commit_author
$ui_comm delete 0.0 end
$ui_comm edit reset
$ui_comm edit modified false
@ -322,11 +325,12 @@ proc commit_writetree {curHEAD msg_p} {
}
proc commit_committree {fd_wt curHEAD msg_p} {
global HEAD PARENT MERGE_HEAD commit_type
global HEAD PARENT MERGE_HEAD commit_type commit_author
global current_branch
global ui_comm selected_commit_type
global file_states selected_paths rescan_active
global repo_config
global env
gets $fd_wt tree_id
if {[catch {close $fd_wt} err]} {
@ -366,6 +370,9 @@ A rescan will be automatically started now.
}
}
if {[info exists commit_author]} {
set old_author [commit_author_ident $commit_author]
}
# -- Create the commit.
#
set cmd [list commit-tree $tree_id]
@ -381,8 +388,14 @@ A rescan will be automatically started now.
error_popup [strcat [mc "commit-tree failed:"] "\n\n$err"]
ui_status [mc "Commit failed."]
unlock_index
unset -nocomplain commit_author
commit_author_reset $old_author
return
}
if {[info exists commit_author]} {
unset -nocomplain commit_author
commit_author_reset $old_author
}
# -- Update the HEAD ref.
#
@ -509,3 +522,20 @@ proc commit_postcommit_wait {fd_ph cmt_id} {
}
fconfigure $fd_ph -blocking 0
}
proc commit_author_ident {details} {
global env
array set author $details
set old [array get env GIT_AUTHOR_*]
set env(GIT_AUTHOR_NAME) $author(name)
set env(GIT_AUTHOR_EMAIL) $author(email)
set env(GIT_AUTHOR_DATE) $author(date)
return $old
}
proc commit_author_reset {details} {
global env
unset env(GIT_AUTHOR_NAME) env(GIT_AUTHOR_EMAIL) env(GIT_AUTHOR_DATE)
if {$details ne {}} {
array set env $details
}
}

View File

@ -54,7 +54,7 @@ proc do_stats {} {
set value "$value[lindex $s 2]"
}
${NS}::label $w.stat.l_$name -text "$label:" -anchor w
${NS}::label $w.stat.l_$name -text [mc "%s:" $label] -anchor w
${NS}::label $w.stat.v_$name -text $value -anchor w
grid $w.stat.l_$name $w.stat.v_$name -sticky we -padx {0 5}
}
@ -63,7 +63,7 @@ proc do_stats {} {
bind $w <Visibility> "grab $w; focus $w.buttons.close"
bind $w <Key-Escape> [list destroy $w]
bind $w <Key-Return> [list destroy $w]
wm title $w [append "[appname] ([reponame]): " [mc "Database Statistics"]]
wm title $w [mc "%s (%s): Database Statistics" [appname] [reponame]]
wm deiconify $w
tkwait window $w
}

View File

@ -127,6 +127,9 @@ proc show_diff {path w {lno {}} {scroll_pos {}} {callback {}}} {
} else {
start_show_diff $cont_info
}
global current_diff_path selected_paths
set selected_paths($current_diff_path) 1
}
proc show_unmerged_diff {cont_info} {
@ -220,10 +223,9 @@ proc show_other_diff {path w m cont_info} {
}
$ui_diff conf -state normal
if {$type eq {submodule}} {
$ui_diff insert end [append \
"* " \
[mc "Git Repository (subproject)"] \
"\n"] d_info
$ui_diff insert end \
"* [mc "Git Repository (subproject)"]\n" \
d_info
} elseif {![catch {set type [exec file $path]}]} {
set n [string length $path]
if {[string equal -length $n $path $type]} {
@ -608,7 +610,7 @@ proc apply_hunk {x y} {
puts -nonewline $p $current_diff_header
puts -nonewline $p [$ui_diff get $s_lno $e_lno]
close $p} err]} {
error_popup [append $failed_msg "\n\n$err"]
error_popup "$failed_msg\n\n$err"
unlock_index
return
}
@ -826,7 +828,7 @@ proc apply_range_or_line {x y} {
puts -nonewline $p $current_diff_header
puts -nonewline $p $wholepatch
close $p} err]} {
error_popup [append $failed_msg "\n\n$err"]
error_popup "$failed_msg\n\n$err"
}
unlock_index

View File

@ -17,7 +17,7 @@ proc error_popup {msg} {
set cmd [list tk_messageBox \
-icon error \
-type ok \
-title [append "$title: " [mc "error"]] \
-title [mc "%s: error" $title] \
-message $msg]
if {[winfo ismapped [_error_parent]]} {
lappend cmd -parent [_error_parent]
@ -33,7 +33,7 @@ proc warn_popup {msg} {
set cmd [list tk_messageBox \
-icon warning \
-type ok \
-title [append "$title: " [mc "warning"]] \
-title [mc "%s: warning" $title] \
-message $msg]
if {[winfo ismapped [_error_parent]]} {
lappend cmd -parent [_error_parent]
@ -77,7 +77,7 @@ proc hook_failed_popup {hook msg {is_fatal 1}} {
wm withdraw $w
${NS}::frame $w.m
${NS}::label $w.m.l1 -text "$hook hook failed:" \
${NS}::label $w.m.l1 -text [mc "%s hook failed:" $hook] \
-anchor w \
-justify left \
-font font_uibold
@ -113,7 +113,7 @@ proc hook_failed_popup {hook msg {is_fatal 1}} {
bind $w <Visibility> "grab $w; focus $w"
bind $w <Key-Return> "destroy $w"
wm title $w [strcat "[appname] ([reponame]): " [mc "error"]]
wm title $w [mc "%s (%s): error" [appname] [reponame]]
wm deiconify $w
tkwait window $w
}

View File

@ -115,7 +115,7 @@ proc write_update_indexinfo {fd pathList totalCnt batch after} {
set info [lindex $s 2]
if {$info eq {}} continue
puts -nonewline $fd "$info\t[encoding convertto $path]\0"
puts -nonewline $fd "$info\t[encoding convertto utf-8 $path]\0"
display_file $path $new
}
@ -186,7 +186,7 @@ proc write_update_index {fd pathList totalCnt batch after} {
?M {set new M_}
?? {continue}
}
puts -nonewline $fd "[encoding convertto $path]\0"
puts -nonewline $fd "[encoding convertto utf-8 $path]\0"
display_file $path $new
}
@ -247,7 +247,7 @@ proc write_checkout_index {fd pathList totalCnt batch after} {
?M -
?T -
?D {
puts -nonewline $fd "[encoding convertto $path]\0"
puts -nonewline $fd "[encoding convertto utf-8 $path]\0"
display_file $path ?_
}
}

View File

@ -112,7 +112,16 @@ method _start {} {
close $fh
set _last_merged_branch $branch
set cmd [list git merge --strategy=recursive FETCH_HEAD]
if {[git-version >= "2.5.0"]} {
set cmd [list git merge --strategy=recursive FETCH_HEAD]
} else {
set cmd [list git]
lappend cmd merge
lappend cmd --strategy=recursive
lappend cmd [git fmt-merge-msg <[gitdir FETCH_HEAD]]
lappend cmd HEAD
lappend cmd $name
}
ui_status [mc "Merging %s and %s..." $current_branch $stitle]
set cons [console::new [mc "Merge"] "merge $stitle"]
@ -144,7 +153,7 @@ constructor dialog {} {
}
make_dialog top w
wm title $top [append "[appname] ([reponame]): " [mc "Merge"]]
wm title $top [mc "%s (%s): Merge" [appname] [reponame]]
if {$top ne {.}} {
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
}

View File

@ -179,7 +179,7 @@ proc do_options {} {
i-* {
regexp -- {-(\d+)\.\.(\d+)$} $type _junk min max
${NS}::frame $w.$f.$optid
${NS}::label $w.$f.$optid.l -text "$text:"
${NS}::label $w.$f.$optid.l -text [mc "%s:" $text]
pack $w.$f.$optid.l -side left -anchor w -fill x
tspinbox $w.$f.$optid.v \
-textvariable ${f}_config_new($name) \
@ -194,7 +194,7 @@ proc do_options {} {
c -
t {
${NS}::frame $w.$f.$optid
${NS}::label $w.$f.$optid.l -text "$text:"
${NS}::label $w.$f.$optid.l -text [mc "%s:" $text]
${NS}::entry $w.$f.$optid.v \
-width 20 \
-textvariable ${f}_config_new($name)
@ -217,7 +217,7 @@ proc do_options {} {
s {
set opts [eval [lindex $option 3]]
${NS}::frame $w.$f.$optid
${NS}::label $w.$f.$optid.l -text "$text:"
${NS}::label $w.$f.$optid.l -text [mc "%s:" $text]
if {$use_ttk} {
ttk::combobox $w.$f.$optid.v \
-textvariable ${f}_config_new($name) \
@ -279,7 +279,7 @@ proc do_options {} {
[font configure $font -size]
${NS}::frame $w.global.$name
${NS}::label $w.global.$name.l -text "$text:"
${NS}::label $w.global.$name.l -text [mc "%s:" $text]
${NS}::button $w.global.$name.b \
-text [mc "Change Font"] \
-command [list \

View File

@ -246,22 +246,22 @@ proc update_all_remotes_menu_entry {} {
if {$have_remote > 1} {
make_sure_remote_submenues_exist $remote_m
if {[$fetch_m type end] eq "command" \
&& [$fetch_m entrycget end -label] ne "All"} {
&& [$fetch_m entrycget end -label] ne [mc "All"]} {
$fetch_m insert end separator
$fetch_m insert end command \
-label "All" \
-label [mc "All"] \
-command fetch_from_all
$prune_m insert end separator
$prune_m insert end command \
-label "All" \
-label [mc "All"] \
-command prune_from_all
}
} else {
if {[winfo exists $fetch_m]} {
if {[$fetch_m type end] eq "command" \
&& [$fetch_m entrycget end -label] eq "All"} {
&& [$fetch_m entrycget end -label] eq [mc "All"]} {
delete_from_menu $fetch_m end
delete_from_menu $fetch_m end

View File

@ -17,7 +17,7 @@ constructor dialog {} {
make_dialog top w
wm withdraw $top
wm title $top [append "[appname] ([reponame]): " [mc "Add Remote"]]
wm title $top [mc "%s (%s): Add Remote" [appname] [reponame]]
if {$top ne {.}} {
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
}

View File

@ -26,7 +26,7 @@ constructor dialog {} {
global all_remotes M1B use_ttk NS
make_dialog top w
wm title $top [append "[appname] ([reponame]): " [mc "Delete Branch Remotely"]]
wm title $top [mc "%s (%s): Delete Branch Remotely" [appname] [reponame]]
if {$top ne {.}} {
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
}

View File

@ -5,17 +5,20 @@ proc do_windows_shortcut {} {
global _gitworktree
set fn [tk_getSaveFile \
-parent . \
-title [append "[appname] ([reponame]): " [mc "Create Desktop Icon"]] \
-title [mc "%s (%s): Create Desktop Icon" [appname] [reponame]] \
-initialfile "Git [reponame].lnk"]
if {$fn != {}} {
if {[file extension $fn] ne {.lnk}} {
set fn ${fn}.lnk
}
# Use git-gui.exe if available (ie: git-for-windows)
set cmdLine [auto_execok git-gui.exe]
if {$cmdLine eq {}} {
set cmdLine [list [info nameofexecutable] \
[file normalize $::argv0]]
}
if {[catch {
win32_create_lnk $fn [list \
[info nameofexecutable] \
[file normalize $::argv0] \
] \
win32_create_lnk $fn $cmdLine \
[file normalize $_gitworktree]
} err]} {
error_popup [strcat [mc "Cannot write shortcut:"] "\n\n$err"]
@ -37,7 +40,7 @@ proc do_cygwin_shortcut {} {
}
set fn [tk_getSaveFile \
-parent . \
-title [append "[appname] ([reponame]): " [mc "Create Desktop Icon"]] \
-title [mc "%s (%s): Create Desktop Icon" [appname] [reponame]] \
-initialdir $desktop \
-initialfile "Git [reponame].lnk"]
if {$fn != {}} {
@ -69,7 +72,7 @@ proc do_macosx_app {} {
set fn [tk_getSaveFile \
-parent . \
-title [append "[appname] ([reponame]): " [mc "Create Desktop Icon"]] \
-title [mc "%s (%s): Create Desktop Icon" [appname] [reponame]] \
-initialdir [file join $env(HOME) Desktop] \
-initialfile "Git [reponame].app"]
if {$fn != {}} {

View File

@ -78,6 +78,57 @@ proc InitTheme {} {
}
}
# Define a style used for the surround of text widgets.
proc InitEntryFrame {} {
ttk::style theme settings default {
ttk::style layout EntryFrame {
EntryFrame.field -sticky nswe -border 0 -children {
EntryFrame.fill -sticky nswe -children {
EntryFrame.padding -sticky nswe
}
}
}
ttk::style configure EntryFrame -padding 1 -relief sunken
ttk::style map EntryFrame -background {}
}
ttk::style theme settings classic {
ttk::style configure EntryFrame -padding 2 -relief sunken
ttk::style map EntryFrame -background {}
}
ttk::style theme settings alt {
ttk::style configure EntryFrame -padding 2
ttk::style map EntryFrame -background {}
}
ttk::style theme settings clam {
ttk::style configure EntryFrame -padding 2
ttk::style map EntryFrame -background {}
}
# Ignore errors for missing native themes
catch {
ttk::style theme settings winnative {
ttk::style configure EntryFrame -padding 2
}
ttk::style theme settings xpnative {
ttk::style configure EntryFrame -padding 1
ttk::style element create EntryFrame.field vsapi \
EDIT 1 {disabled 4 focus 3 active 2 {} 1} -padding 1
}
ttk::style theme settings vista {
ttk::style configure EntryFrame -padding 2
ttk::style element create EntryFrame.field vsapi \
EDIT 6 {disabled 4 focus 3 active 2 {} 1} -padding 2
}
}
bind EntryFrame <Enter> {%W instate !disabled {%W state active}}
bind EntryFrame <Leave> {%W state !active}
bind EntryFrame <<ThemeChanged>> {
set pad [ttk::style lookup EntryFrame -padding]
%W configure -padding [expr {$pad eq {} ? 1 : $pad}]
}
}
proc gold_frame {w args} {
global use_ttk
if {$use_ttk} {
@ -123,7 +174,7 @@ proc paddedlabel {w args} {
# place a themed frame over the surface.
proc Dialog {w args} {
eval [linsert $args 0 toplevel $w -class Dialog]
catch {wm attributes $w -type dialog}
catch {wm attributes $w -type dialog}
pave_toplevel $w
return $w
}
@ -193,6 +244,40 @@ proc tspinbox {w args} {
}
}
# Create a text widget with any theme specific properties.
proc ttext {w args} {
global use_ttk
if {$use_ttk} {
switch -- [ttk::style theme use] {
"vista" - "xpnative" {
lappend args -highlightthickness 0 -borderwidth 0
}
}
}
set w [eval [linsert $args 0 text $w]]
if {$use_ttk} {
if {[winfo class [winfo parent $w]] eq "EntryFrame"} {
bind $w <FocusIn> {[winfo parent %W] state focus}
bind $w <FocusOut> {[winfo parent %W] state !focus}
}
}
return $w
}
# themed frame suitable for surrounding a text field.
proc textframe {w args} {
global use_ttk
if {$use_ttk} {
if {[catch {ttk::style layout EntryFrame}]} {
InitEntryFrame
}
eval [linsert $args 0 ttk::frame $w -class EntryFrame -style EntryFrame]
} else {
eval [linsert $args 0 frame $w]
}
return $w
}
proc tentry {w args} {
global use_ttk
if {$use_ttk} {

View File

@ -69,6 +69,7 @@ proc tools_populate_one {fullname} {
proc tools_exec {fullname} {
global repo_config env current_diff_path
global current_branch is_detached
global selected_paths
if {[is_config_true "guitool.$fullname.needsfile"]} {
if {$current_diff_path eq {}} {
@ -100,6 +101,7 @@ proc tools_exec {fullname} {
set env(GIT_GUITOOL) $fullname
set env(FILENAME) $current_diff_path
set env(FILENAMES) [join [array names selected_paths] \n]
if {$is_detached} {
set env(CUR_BRANCH) ""
} else {
@ -121,6 +123,7 @@ proc tools_exec {fullname} {
unset env(GIT_GUITOOL)
unset env(FILENAME)
unset env(FILENAMES)
unset env(CUR_BRANCH)
catch { unset env(ARGS) }
catch { unset env(REVISION) }

View File

@ -19,7 +19,7 @@ constructor dialog {} {
global repo_config use_ttk NS
make_dialog top w
wm title $top [append "[appname] ([reponame]): " [mc "Add Tool"]]
wm title $top [mc "%s (%s): Add Tool" [appname] [reponame]]
if {$top ne {.}} {
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
wm transient $top .
@ -184,7 +184,7 @@ constructor dialog {} {
load_config 1
make_dialog top w
wm title $top [append "[appname] ([reponame]): " [mc "Remove Tool"]]
wm title $top [mc "%s (%s): Remove Tool" [appname] [reponame]]
if {$top ne {.}} {
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
wm transient $top .
@ -280,7 +280,7 @@ constructor dialog {fullname} {
}
make_dialog top w -autodelete 0
wm title $top [append "[appname] ([reponame]): " $title]
wm title $top "[mc "%s (%s):" [appname] [reponame]] $title"
if {$top ne {.}} {
wm geometry $top "+[winfo rootx .]+[winfo rooty .]"
wm transient $top .

View File

@ -226,7 +226,7 @@ proc do_push_anywhere {} {
bind $w <Visibility> "grab $w; focus $w.buttons.create"
bind $w <Key-Escape> "destroy $w"
bind $w <Key-Return> [list start_push_anywhere_action $w]
wm title $w [append "[appname] ([reponame]): " [mc "Push"]]
wm title $w [mc "%s (%s): Push" [appname] [reponame]]
wm deiconify $w
tkwait window $w
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff