From: Junio C Hamano Date: Sat, 6 Sep 2008 23:03:22 +0000 (-0700) Subject: Merge branch 'maint' of git://repo.or.cz/git-gui into maint X-Git-Tag: v1.6.0.2~16 X-Git-Url: https://git.tokkee.org/?p=git.git;a=commitdiff_plain;h=1b118da8bd1878d78589afd9f755b9d52a9579ad Merge branch 'maint' of git://repo.or.cz/git-gui into maint * 'maint' of git://repo.or.cz/git-gui: git-gui: Fix diff parsing for lines starting with "--" or "++" git-gui: Fix string escaping in po2msg.sh git gui: show diffs with a minimum of 1 context line git-gui: update all remaining translations to French. git-gui: Update french translation --- 1b118da8bd1878d78589afd9f755b9d52a9579ad diff --cc git-gui/git-gui.sh index ad65aaad5,000000000..86402d49f mode 100755,000000..100755 --- a/git-gui/git-gui.sh +++ b/git-gui/git-gui.sh @@@ -1,3028 -1,0 +1,3028 @@@ +#!/bin/sh +# Tcl ignores the next line -*- tcl -*- \ + if test "z$*" = zversion \ + || test "z$*" = z--version; \ + then \ + echo 'git-gui version @@GITGUI_VERSION@@'; \ + exit; \ + fi; \ + argv0=$0; \ + exec wish "$argv0" -- "$@" + +set appvers {@@GITGUI_VERSION@@} +set copyright [encoding convertfrom utf-8 { +Copyright © 2006, 2007 Shawn Pearce, et. al. + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA}] + +###################################################################### +## +## Tcl/Tk sanity check + +if {[catch {package require Tcl 8.4} err] + || [catch {package require Tk 8.4} err] +} { + catch {wm withdraw .} + tk_messageBox \ + -icon error \ + -type ok \ + -title [mc "git-gui: fatal error"] \ + -message $err + exit 1 +} + +catch {rename send {}} ; # What an evil concept... + +###################################################################### +## +## locate our library + +set oguilib {@@GITGUI_LIBDIR@@} +set oguirel {@@GITGUI_RELATIVE@@} +if {$oguirel eq {1}} { + set oguilib [file dirname [file normalize $argv0]] + if {[file tail $oguilib] eq {git-core}} { + set oguilib [file dirname $oguilib] + } + set oguilib [file dirname $oguilib] + set oguilib [file join $oguilib share git-gui lib] + set oguimsg [file join $oguilib msgs] +} elseif {[string match @@* $oguirel]} { + set oguilib [file join [file dirname [file normalize $argv0]] lib] + set oguimsg [file join [file dirname [file normalize $argv0]] po] +} else { + set oguimsg [file join $oguilib msgs] +} +unset oguirel + +###################################################################### +## +## enable verbose loading? + +if {![catch {set _verbose $env(GITGUI_VERBOSE)}]} { + unset _verbose + rename auto_load real__auto_load + proc auto_load {name args} { + puts stderr "auto_load $name" + return [uplevel 1 real__auto_load $name $args] + } + rename source real__source + proc source {name} { + puts stderr "source $name" + uplevel 1 real__source $name + } +} + +###################################################################### +## +## Internationalization (i18n) through msgcat and gettext. See +## http://www.gnu.org/software/gettext/manual/html_node/Tcl.html + +package require msgcat + +proc _mc_trim {fmt} { + set cmk [string first @@ $fmt] + if {$cmk > 0} { + return [string range $fmt 0 [expr {$cmk - 1}]] + } + return $fmt +} + +proc mc {en_fmt args} { + set fmt [_mc_trim [::msgcat::mc $en_fmt]] + if {[catch {set msg [eval [list format $fmt] $args]} err]} { + set msg [eval [list format [_mc_trim $en_fmt]] $args] + } + return $msg +} + +proc strcat {args} { + return [join $args {}] +} + +::msgcat::mcload $oguimsg +unset oguimsg + +###################################################################### +## +## read only globals + +set _appname {Git Gui} +set _gitdir {} +set _gitexec {} +set _reponame {} +set _iscygwin {} +set _search_path {} + +set _trace [lsearch -exact $argv --trace] +if {$_trace >= 0} { + set argv [lreplace $argv $_trace $_trace] + set _trace 1 +} else { + set _trace 0 +} + +proc appname {} { + global _appname + return $_appname +} + +proc gitdir {args} { + global _gitdir + if {$args eq {}} { + return $_gitdir + } + return [eval [list file join $_gitdir] $args] +} + +proc gitexec {args} { + global _gitexec + if {$_gitexec eq {}} { + if {[catch {set _gitexec [git --exec-path]} err]} { + error "Git not installed?\n\n$err" + } + if {[is_Cygwin]} { + set _gitexec [exec cygpath \ + --windows \ + --absolute \ + $_gitexec] + } else { + set _gitexec [file normalize $_gitexec] + } + } + if {$args eq {}} { + return $_gitexec + } + return [eval [list file join $_gitexec] $args] +} + +proc reponame {} { + return $::_reponame +} + +proc is_MacOSX {} { + if {[tk windowingsystem] eq {aqua}} { + return 1 + } + return 0 +} + +proc is_Windows {} { + if {$::tcl_platform(platform) eq {windows}} { + return 1 + } + return 0 +} + +proc is_Cygwin {} { + global _iscygwin + if {$_iscygwin eq {}} { + if {$::tcl_platform(platform) eq {windows}} { + if {[catch {set p [exec cygpath --windir]} err]} { + set _iscygwin 0 + } else { + set _iscygwin 1 + } + } else { + set _iscygwin 0 + } + } + return $_iscygwin +} + +proc is_enabled {option} { + global enabled_options + if {[catch {set on $enabled_options($option)}]} {return 0} + return $on +} + +proc enable_option {option} { + global enabled_options + set enabled_options($option) 1 +} + +proc disable_option {option} { + global enabled_options + set enabled_options($option) 0 +} + +###################################################################### +## +## config + +proc is_many_config {name} { + switch -glob -- $name { + gui.recentrepo - + remote.*.fetch - + remote.*.push + {return 1} + * + {return 0} + } +} + +proc is_config_true {name} { + global repo_config + if {[catch {set v $repo_config($name)}]} { + return 0 + } elseif {$v eq {true} || $v eq {1} || $v eq {yes}} { + return 1 + } else { + return 0 + } +} + +proc get_config {name} { + global repo_config + if {[catch {set v $repo_config($name)}]} { + return {} + } else { + return $v + } +} + +###################################################################### +## +## handy utils + +proc _trace_exec {cmd} { + if {!$::_trace} return + set d {} + foreach v $cmd { + if {$d ne {}} { + append d { } + } + if {[regexp {[ \t\r\n'"$?*]} $v]} { + set v [sq $v] + } + append d $v + } + puts stderr $d +} + +proc _git_cmd {name} { + global _git_cmd_path + + if {[catch {set v $_git_cmd_path($name)}]} { + switch -- $name { + version - + --version - + --exec-path { return [list $::_git $name] } + } + + set p [gitexec git-$name$::_search_exe] + if {[file exists $p]} { + set v [list $p] + } elseif {[is_Windows] && [file exists [gitexec git-$name]]} { + # Try to determine what sort of magic will make + # git-$name go and do its thing, because native + # Tcl on Windows doesn't know it. + # + set p [gitexec git-$name] + set f [open $p r] + set s [gets $f] + close $f + + switch -glob -- [lindex $s 0] { + #!*sh { set i sh } + #!*perl { set i perl } + #!*python { set i python } + default { error "git-$name is not supported: $s" } + } + + upvar #0 _$i interp + if {![info exists interp]} { + set interp [_which $i] + } + if {$interp eq {}} { + error "git-$name requires $i (not in PATH)" + } + set v [concat [list $interp] [lrange $s 1 end] [list $p]] + } else { + # Assume it is builtin to git somehow and we + # aren't actually able to see a file for it. + # + set v [list $::_git $name] + } + set _git_cmd_path($name) $v + } + return $v +} + +proc _which {what args} { + global env _search_exe _search_path + + if {$_search_path eq {}} { + if {[is_Cygwin] && [regexp {^(/|\.:)} $env(PATH)]} { + set _search_path [split [exec cygpath \ + --windows \ + --path \ + --absolute \ + $env(PATH)] {;}] + set _search_exe .exe + } elseif {[is_Windows]} { + set gitguidir [file dirname [info script]] + regsub -all ";" $gitguidir "\\;" gitguidir + set env(PATH) "$gitguidir;$env(PATH)" + set _search_path [split $env(PATH) {;}] + set _search_exe .exe + } else { + set _search_path [split $env(PATH) :] + set _search_exe {} + } + } + + if {[is_Windows] && [lsearch -exact $args -script] >= 0} { + set suffix {} + } else { + set suffix $_search_exe + } + + foreach p $_search_path { + set p [file join $p $what$suffix] + if {[file exists $p]} { + return [file normalize $p] + } + } + return {} +} + +proc _lappend_nice {cmd_var} { + global _nice + upvar $cmd_var cmd + + if {![info exists _nice]} { + set _nice [_which nice] + } + if {$_nice ne {}} { + lappend cmd $_nice + } +} + +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] + if {$::_trace} { + puts stderr "< $result" + } + return $result +} + +proc _open_stdout_stderr {cmd} { + _trace_exec $cmd + if {[catch { + set fd [open [concat [list | ] $cmd] r] + } err]} { + if { [lindex $cmd end] eq {2>@1} + && $err eq {can not find channel named "1"} + } { + # Older versions of Tcl 8.4 don't have this 2>@1 IO + # redirect operator. Fallback to |& cat for those. + # The command was not actually started, so its safe + # to try to start it a second time. + # + set fd [open [concat \ + [list | ] \ + [lrange $cmd 0 end-1] \ + [list |& cat] \ + ] r] + } else { + error $err + } + } + fconfigure $fd -eofchar {} + return $fd +} + +proc git_read {args} { + set opt [list] + + while {1} { + switch -- [lindex $args 0] { + --nice { + _lappend_nice opt + } + + --stderr { + lappend args 2>@1 + } + + default { + break + } + + } + + set args [lrange $args 1 end] + } + + set cmdp [_git_cmd [lindex $args 0]] + set args [lrange $args 1 end] + + return [_open_stdout_stderr [concat $opt $cmdp $args]] +} + +proc git_write {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] + return [open [concat [list | ] $opt $cmdp $args] w] +} + +proc githook_read {hook_name args} { + set pchook [gitdir hooks $hook_name] + lappend args 2>@1 + + # On Windows [file executable] might lie so we need to ask + # the shell if the hook is executable. Yes that's annoying. + # + if {[is_Windows]} { + upvar #0 _sh interp + if {![info exists interp]} { + set interp [_which sh] + } + if {$interp eq {}} { + error "hook execution requires sh (not in PATH)" + } + + set scr {if test -x "$1";then exec "$@";fi} + set sh_c [list $interp -c $scr $interp $pchook] + return [_open_stdout_stderr [concat $sh_c $args]] + } + + if {[file executable $pchook]} { + return [_open_stdout_stderr [concat [list $pchook] $args]] + } + + return {} +} + +proc kill_file_process {fd} { + set process [pid $fd] + + catch { + if {[is_Windows]} { + # Use a Cygwin-specific flag to allow killing + # native Windows processes + exec kill -f $process + } else { + exec kill $process + } + } +} + +proc sq {value} { + regsub -all ' $value "'\\''" value + return "'$value'" +} + +proc load_current_branch {} { + global current_branch is_detached + + set fd [open [gitdir HEAD] r] + if {[gets $fd ref] < 1} { + set ref {} + } + close $fd + + set pfx {ref: refs/heads/} + set len [string length $pfx] + if {[string equal -length $len $pfx $ref]} { + # We're on a branch. It might not exist. But + # HEAD looks good enough to be a branch. + # + set current_branch [string range $ref $len end] + set is_detached 0 + } else { + # Assume this is a detached head. + # + set current_branch HEAD + set is_detached 1 + } +} + +auto_load tk_optionMenu +rename tk_optionMenu real__tkOptionMenu +proc tk_optionMenu {w varName args} { + set m [eval real__tkOptionMenu $w $varName $args] + $m configure -font font_ui + $w configure -font font_ui + return $m +} + +proc rmsel_tag {text} { + $text tag conf sel \ + -background [$text cget -background] \ + -foreground [$text cget -foreground] \ + -borderwidth 0 + $text tag conf in_sel -background lightgray + bind $text break + return $text +} + +set root_exists 0 +bind . { + bind . {} + set root_exists 1 +} + +if {[is_Windows]} { + wm iconbitmap . -default $oguilib/git-gui.ico +} + +###################################################################### +## +## config defaults + +set cursor_ptr arrow +font create font_diff -family Courier -size 10 +font create font_ui +catch { + label .dummy + eval font configure font_ui [font actual [.dummy cget -font]] + destroy .dummy +} + +font create font_uiitalic +font create font_uibold +font create font_diffbold +font create font_diffitalic + +foreach class {Button Checkbutton Entry Label + Labelframe Listbox Menu Message + Radiobutton Spinbox Text} { + option add *$class.font font_ui +} +unset class + +if {[is_Windows] || [is_MacOSX]} { + option add *Menu.tearOff 0 +} + +if {[is_MacOSX]} { + set M1B M1 + set M1T Cmd +} else { + set M1B Control + set M1T Ctrl +} + +proc bind_button3 {w cmd} { + bind $w $cmd + if {[is_MacOSX]} { + # Mac OS X sends Button-2 on right click through three-button mouse, + # or through trackpad right-clicking (two-finger touch + click). + bind $w $cmd + bind $w $cmd + } +} + +proc apply_config {} { + global repo_config font_descs + + foreach option $font_descs { + set name [lindex $option 0] + set font [lindex $option 1] + if {[catch { + set need_weight 1 + foreach {cn cv} $repo_config(gui.$name) { + if {$cn eq {-weight}} { + set need_weight 0 + } + font configure $font $cn $cv + } + if {$need_weight} { + font configure $font -weight normal + } + } err]} { + error_popup [strcat [mc "Invalid font specified in %s:" "gui.$name"] "\n\n$err"] + } + foreach {cn cv} [font configure $font] { + font configure ${font}bold $cn $cv + font configure ${font}italic $cn $cv + } + font configure ${font}bold -weight bold + font configure ${font}italic -slant italic + } +} + +set default_config(branch.autosetupmerge) true +set default_config(merge.diffstat) true +set default_config(merge.summary) false +set default_config(merge.verbosity) 2 +set default_config(user.name) {} +set default_config(user.email) {} + +set default_config(gui.matchtrackingbranch) false +set default_config(gui.pruneduringfetch) false +set default_config(gui.trustmtime) false +set default_config(gui.fastcopyblame) false +set default_config(gui.copyblamethreshold) 40 +set default_config(gui.diffcontext) 5 +set default_config(gui.commitmsgwidth) 75 +set default_config(gui.newbranchtemplate) {} +set default_config(gui.spellingdictionary) {} +set default_config(gui.fontui) [font configure font_ui] +set default_config(gui.fontdiff) [font configure font_diff] +set font_descs { + {fontui font_ui {mc "Main Font"}} + {fontdiff font_diff {mc "Diff/Console Font"}} +} + +###################################################################### +## +## find git + +set _git [_which git] +if {$_git eq {}} { + catch {wm withdraw .} + tk_messageBox \ + -icon error \ + -type ok \ + -title [mc "git-gui: fatal error"] \ + -message [mc "Cannot find git in PATH."] + exit 1 +} + +###################################################################### +## +## version check + +if {[catch {set _git_version [git --version]} err]} { + catch {wm withdraw .} + tk_messageBox \ + -icon error \ + -type ok \ + -title [mc "git-gui: fatal error"] \ + -message "Cannot determine Git version: + +$err + +[appname] requires Git 1.5.0 or later." + exit 1 +} +if {![regsub {^git version } $_git_version {} _git_version]} { + catch {wm withdraw .} + tk_messageBox \ + -icon error \ + -type ok \ + -title [mc "git-gui: fatal error"] \ + -message [strcat [mc "Cannot parse Git version string:"] "\n\n$_git_version"] + exit 1 +} + +set _real_git_version $_git_version +regsub -- {[\-\.]dirty$} $_git_version {} _git_version +regsub {\.[0-9]+\.g[0-9a-f]+$} $_git_version {} _git_version +regsub {\.rc[0-9]+$} $_git_version {} _git_version +regsub {\.GIT$} $_git_version {} _git_version +regsub {\.[a-zA-Z]+\.[0-9]+$} $_git_version {} _git_version + +if {![regexp {^[1-9]+(\.[0-9]+)+$} $_git_version]} { + catch {wm withdraw .} + if {[tk_messageBox \ + -icon warning \ + -type yesno \ + -default no \ + -title "[appname]: warning" \ + -message [mc "Git version cannot be determined. + +%s claims it is version '%s'. + +%s requires at least Git 1.5.0 or later. + +Assume '%s' is version 1.5.0? +" $_git $_real_git_version [appname] $_real_git_version]] eq {yes}} { + set _git_version 1.5.0 + } else { + exit 1 + } +} +unset _real_git_version + +proc git-version {args} { + global _git_version + + switch [llength $args] { + 0 { + return $_git_version + } + + 2 { + set op [lindex $args 0] + set vr [lindex $args 1] + set cm [package vcompare $_git_version $vr] + return [expr $cm $op 0] + } + + 4 { + set type [lindex $args 0] + set name [lindex $args 1] + set parm [lindex $args 2] + set body [lindex $args 3] + + if {($type ne {proc} && $type ne {method})} { + error "Invalid arguments to git-version" + } + if {[llength $body] < 2 || [lindex $body end-1] ne {default}} { + error "Last arm of $type $name must be default" + } + + foreach {op vr cb} [lrange $body 0 end-2] { + if {[git-version $op $vr]} { + return [uplevel [list $type $name $parm $cb]] + } + } + + return [uplevel [list $type $name $parm [lindex $body end]]] + } + + default { + error "git-version >= x" + } + + } +} + +if {[git-version < 1.5]} { + catch {wm withdraw .} + tk_messageBox \ + -icon error \ + -type ok \ + -title [mc "git-gui: fatal error"] \ + -message "[appname] requires Git 1.5.0 or later. + +You are using [git-version]: + +[git --version]" + exit 1 +} + +###################################################################### +## +## configure our library + +set idx [file join $oguilib tclIndex] +if {[catch {set fd [open $idx r]} err]} { + catch {wm withdraw .} + tk_messageBox \ + -icon error \ + -type ok \ + -title [mc "git-gui: fatal error"] \ + -message $err + exit 1 +} +if {[gets $fd] eq {# Autogenerated by git-gui Makefile}} { + set idx [list] + while {[gets $fd n] >= 0} { + if {$n ne {} && ![string match #* $n]} { + lappend idx $n + } + } +} else { + set idx {} +} +close $fd + +if {$idx ne {}} { + set loaded [list] + foreach p $idx { + if {[lsearch -exact $loaded $p] >= 0} continue + source [file join $oguilib $p] + lappend loaded $p + } + unset loaded p +} else { + set auto_path [concat [list $oguilib] $auto_path] +} +unset -nocomplain idx fd + +###################################################################### +## +## config file parsing + +git-version proc _parse_config {arr_name args} { + >= 1.5.3 { + upvar $arr_name arr + array unset arr + set buf {} + catch { + set fd_rc [eval \ + [list git_read config] \ + $args \ + [list --null --list]] + fconfigure $fd_rc -translation binary + set buf [read $fd_rc] + close $fd_rc + } + foreach line [split $buf "\0"] { + if {[regexp {^([^\n]+)\n(.*)$} $line line name value]} { + if {[is_many_config $name]} { + lappend arr($name) $value + } else { + set arr($name) $value + } + } + } + } + default { + upvar $arr_name arr + array unset arr + catch { + set fd_rc [eval [list git_read config --list] $args] + while {[gets $fd_rc line] >= 0} { + if {[regexp {^([^=]+)=(.*)$} $line line name value]} { + if {[is_many_config $name]} { + lappend arr($name) $value + } else { + set arr($name) $value + } + } + } + close $fd_rc + } + } +} + +proc load_config {include_global} { + global repo_config global_config default_config + + if {$include_global} { + _parse_config global_config --global + } + _parse_config repo_config + + foreach name [array names default_config] { + if {[catch {set v $global_config($name)}]} { + set global_config($name) $default_config($name) + } + if {[catch {set v $repo_config($name)}]} { + set repo_config($name) $default_config($name) + } + } +} + +###################################################################### +## +## feature option selection + +if {[regexp {^git-(.+)$} [file tail $argv0] _junk subcommand]} { + unset _junk +} else { + set subcommand gui +} +if {$subcommand eq {gui.sh}} { + set subcommand gui +} +if {$subcommand eq {gui} && [llength $argv] > 0} { + set subcommand [lindex $argv 0] + set argv [lrange $argv 1 end] +} + +enable_option multicommit +enable_option branch +enable_option transport +disable_option bare + +switch -- $subcommand { +browser - +blame { + enable_option bare + + disable_option multicommit + disable_option branch + disable_option transport +} +citool { + enable_option singlecommit + + disable_option multicommit + disable_option branch + disable_option transport +} +} + +###################################################################### +## +## repository setup + +if {[catch { + set _gitdir $env(GIT_DIR) + set _prefix {} + }] + && [catch { + set _gitdir [git rev-parse --git-dir] + set _prefix [git rev-parse --show-prefix] + } err]} { + load_config 1 + apply_config + choose_repository::pick +} +if {![file isdirectory $_gitdir] && [is_Cygwin]} { + catch {set _gitdir [exec cygpath --windows $_gitdir]} +} +if {![file isdirectory $_gitdir]} { + catch {wm withdraw .} + error_popup [strcat [mc "Git directory not found:"] "\n\n$_gitdir"] + exit 1 +} +if {$_prefix ne {}} { + regsub -all {[^/]+/} $_prefix ../ cdup + if {[catch {cd $cdup} err]} { + catch {wm withdraw .} + error_popup [strcat [mc "Cannot move to top of working directory:"] "\n\n$err"] + exit 1 + } + unset cdup +} elseif {![is_enabled bare]} { + if {[lindex [file split $_gitdir] end] ne {.git}} { + catch {wm withdraw .} + error_popup [strcat [mc "Cannot use funny .git directory:"] "\n\n$_gitdir"] + exit 1 + } + if {[catch {cd [file dirname $_gitdir]} err]} { + catch {wm withdraw .} + error_popup [strcat [mc "No working directory"] " [file dirname $_gitdir]:\n\n$err"] + exit 1 + } +} +set _reponame [file split [file normalize $_gitdir]] +if {[lindex $_reponame end] eq {.git}} { + set _reponame [lindex $_reponame end-1] +} else { + set _reponame [lindex $_reponame end] +} + +###################################################################### +## +## global init + +set current_diff_path {} +set current_diff_side {} +set diff_actions [list] + +set HEAD {} +set PARENT {} +set MERGE_HEAD [list] +set commit_type {} +set empty_tree {} +set current_branch {} +set is_detached 0 +set current_diff_path {} +set is_3way_diff 0 +set selected_commit_type new + +###################################################################### +## +## task management + +set rescan_active 0 +set diff_active 0 +set last_clicked {} + +set disable_on_lock [list] +set index_lock_type none + +proc lock_index {type} { + global index_lock_type disable_on_lock + + if {$index_lock_type eq {none}} { + set index_lock_type $type + foreach w $disable_on_lock { + uplevel #0 $w disabled + } + return 1 + } elseif {$index_lock_type eq "begin-$type"} { + set index_lock_type $type + return 1 + } + return 0 +} + +proc unlock_index {} { + global index_lock_type disable_on_lock + + set index_lock_type none + foreach w $disable_on_lock { + uplevel #0 $w normal + } +} + +###################################################################### +## +## status + +proc repository_state {ctvar hdvar mhvar} { + global current_branch + upvar $ctvar ct $hdvar hd $mhvar mh + + set mh [list] + + load_current_branch + if {[catch {set hd [git rev-parse --verify HEAD]}]} { + set hd {} + set ct initial + return + } + + set merge_head [gitdir MERGE_HEAD] + if {[file exists $merge_head]} { + set ct merge + set fd_mh [open $merge_head r] + while {[gets $fd_mh line] >= 0} { + lappend mh $line + } + close $fd_mh + return + } + + set ct normal +} + +proc PARENT {} { + global PARENT empty_tree + + set p [lindex $PARENT 0] + if {$p ne {}} { + return $p + } + if {$empty_tree eq {}} { + set empty_tree [git mktree << {}] + } + return $empty_tree +} + +proc rescan {after {honor_trustmtime 1}} { + global HEAD PARENT MERGE_HEAD commit_type + global ui_index ui_workdir ui_comm + global rescan_active file_states + global repo_config + + if {$rescan_active > 0 || ![lock_index read]} return + + repository_state newType newHEAD newMERGE_HEAD + if {[string match amend* $commit_type] + && $newType eq {normal} + && $newHEAD eq $HEAD} { + } else { + set HEAD $newHEAD + set PARENT $newHEAD + set MERGE_HEAD $newMERGE_HEAD + set commit_type $newType + } + + array unset file_states + + if {!$::GITGUI_BCK_exists && + (![$ui_comm edit modified] + || [string trim [$ui_comm get 0.0 end]] eq {})} { + if {[string match amend* $commit_type]} { + } elseif {[load_message GITGUI_MSG]} { + } elseif {[load_message MERGE_MSG]} { + } elseif {[load_message SQUASH_MSG]} { + } + $ui_comm edit reset + $ui_comm edit modified false + } + + if {$honor_trustmtime && $repo_config(gui.trustmtime) eq {true}} { + rescan_stage2 {} $after + } else { + set rescan_active 1 + ui_status [mc "Refreshing file status..."] + set fd_rf [git_read update-index \ + -q \ + --unmerged \ + --ignore-missing \ + --refresh \ + ] + fconfigure $fd_rf -blocking 0 -translation binary + fileevent $fd_rf readable \ + [list rescan_stage2 $fd_rf $after] + } +} + +if {[is_Cygwin]} { + set is_git_info_exclude {} + proc have_info_exclude {} { + global is_git_info_exclude + + if {$is_git_info_exclude eq {}} { + if {[catch {exec test -f [gitdir info exclude]}]} { + set is_git_info_exclude 0 + } else { + set is_git_info_exclude 1 + } + } + return $is_git_info_exclude + } +} else { + proc have_info_exclude {} { + return [file readable [gitdir info exclude]] + } +} + +proc rescan_stage2 {fd after} { + global rescan_active buf_rdi buf_rdf buf_rlo + + if {$fd ne {}} { + read $fd + if {![eof $fd]} return + close $fd + } + + set ls_others [list --exclude-per-directory=.gitignore] + if {[have_info_exclude]} { + lappend ls_others "--exclude-from=[gitdir info exclude]" + } + set user_exclude [get_config core.excludesfile] + if {$user_exclude ne {} && [file readable $user_exclude]} { + lappend ls_others "--exclude-from=$user_exclude" + } + + set buf_rdi {} + set buf_rdf {} + set buf_rlo {} + + set rescan_active 3 + ui_status [mc "Scanning for modified files ..."] + set fd_di [git_read diff-index --cached -z [PARENT]] + set fd_df [git_read diff-files -z] + set fd_lo [eval git_read ls-files --others -z $ls_others] + + fconfigure $fd_di -blocking 0 -translation binary -encoding binary + fconfigure $fd_df -blocking 0 -translation binary -encoding binary + fconfigure $fd_lo -blocking 0 -translation binary -encoding binary + fileevent $fd_di readable [list read_diff_index $fd_di $after] + fileevent $fd_df readable [list read_diff_files $fd_df $after] + fileevent $fd_lo readable [list read_ls_others $fd_lo $after] +} + +proc load_message {file} { + global ui_comm + + set f [gitdir $file] + if {[file isfile $f]} { + if {[catch {set fd [open $f r]}]} { + return 0 + } + fconfigure $fd -eofchar {} + set content [string trim [read $fd]] + close $fd + regsub -all -line {[ \r\t]+$} $content {} content + $ui_comm delete 0.0 end + $ui_comm insert end $content + return 1 + } + return 0 +} + +proc read_diff_index {fd after} { + global buf_rdi + + append buf_rdi [read $fd] + set c 0 + set n [string length $buf_rdi] + while {$c < $n} { + set z1 [string first "\0" $buf_rdi $c] + if {$z1 == -1} break + incr z1 + set z2 [string first "\0" $buf_rdi $z1] + if {$z2 == -1} break + + incr c + 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] \ + [lindex $i 4]? \ + [list [lindex $i 0] [lindex $i 2]] \ + [list] + set c $z2 + incr c + } + if {$c < $n} { + set buf_rdi [string range $buf_rdi $c end] + } else { + set buf_rdi {} + } + + rescan_done $fd buf_rdi $after +} + +proc read_diff_files {fd after} { + global buf_rdf + + append buf_rdf [read $fd] + set c 0 + set n [string length $buf_rdf] + while {$c < $n} { + set z1 [string first "\0" $buf_rdf $c] + if {$z1 == -1} break + incr z1 + set z2 [string first "\0" $buf_rdf $z1] + if {$z2 == -1} break + + incr c + 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] \ + ?[lindex $i 4] \ + [list] \ + [list [lindex $i 0] [lindex $i 2]] + set c $z2 + incr c + } + if {$c < $n} { + set buf_rdf [string range $buf_rdf $c end] + } else { + set buf_rdf {} + } + + rescan_done $fd buf_rdf $after +} + +proc read_ls_others {fd after} { + global buf_rlo + + append buf_rlo [read $fd] + set pck [split $buf_rlo "\0"] + set buf_rlo [lindex $pck end] + foreach p [lrange $pck 0 end-1] { + set p [encoding convertfrom $p] + if {[string index $p end] eq {/}} { + set p [string range $p 0 end-1] + } + merge_state $p ?O + } + rescan_done $fd buf_rlo $after +} + +proc rescan_done {fd buf after} { + global rescan_active current_diff_path + global file_states repo_config + upvar $buf to_clear + + if {![eof $fd]} return + set to_clear {} + close $fd + if {[incr rescan_active -1] > 0} return + + prune_selection + unlock_index + display_all_files + if {$current_diff_path ne {}} reshow_diff + uplevel #0 $after +} + +proc prune_selection {} { + global file_states selected_paths + + foreach path [array names selected_paths] { + if {[catch {set still_here $file_states($path)}]} { + unset selected_paths($path) + } + } +} + +###################################################################### +## +## ui helpers + +proc mapicon {w state path} { + global all_icons + + if {[catch {set r $all_icons($state$w)}]} { + puts "error: no icon for $w state={$state} $path" + return file_plain + } + return $r +} + +proc mapdesc {state path} { + global all_descs + + if {[catch {set r $all_descs($state)}]} { + puts "error: no desc for state={$state} $path" + return $state + } + return $r +} + +proc ui_status {msg} { + global main_status + if {[info exists main_status]} { + $main_status show $msg + } +} + +proc ui_ready {{test {}}} { + global main_status + if {[info exists main_status]} { + $main_status show [mc "Ready."] $test + } +} + +proc escape_path {path} { + regsub -all {\\} $path "\\\\" path + regsub -all "\n" $path "\\n" path + return $path +} + +proc short_path {path} { + return [escape_path [lindex [file split $path] end]] +} + +set next_icon_id 0 +set null_sha1 [string repeat 0 40] + +proc merge_state {path new_state {head_info {}} {index_info {}}} { + global file_states next_icon_id null_sha1 + + set s0 [string index $new_state 0] + set s1 [string index $new_state 1] + + if {[catch {set info $file_states($path)}]} { + set state __ + set icon n[incr next_icon_id] + } else { + set state [lindex $info 0] + set icon [lindex $info 1] + if {$head_info eq {}} {set head_info [lindex $info 2]} + if {$index_info eq {}} {set index_info [lindex $info 3]} + } + + if {$s0 eq {?}} {set s0 [string index $state 0]} \ + elseif {$s0 eq {_}} {set s0 _} + + if {$s1 eq {?}} {set s1 [string index $state 1]} \ + elseif {$s1 eq {_}} {set s1 _} + + if {$s0 eq {A} && $s1 eq {_} && $head_info eq {}} { + set head_info [list 0 $null_sha1] + } elseif {$s0 ne {_} && [string index $state 0] eq {_} + && $head_info eq {}} { + set head_info $index_info + } + + set file_states($path) [list $s0$s1 $icon \ + $head_info $index_info \ + ] + return $state +} + +proc display_file_helper {w path icon_name old_m new_m} { + global file_lists + + if {$new_m eq {_}} { + set lno [lsearch -sorted -exact $file_lists($w) $path] + if {$lno >= 0} { + set file_lists($w) [lreplace $file_lists($w) $lno $lno] + incr lno + $w conf -state normal + $w delete $lno.0 [expr {$lno + 1}].0 + $w conf -state disabled + } + } elseif {$old_m eq {_} && $new_m ne {_}} { + lappend file_lists($w) $path + set file_lists($w) [lsort -unique $file_lists($w)] + set lno [lsearch -sorted -exact $file_lists($w) $path] + incr lno + $w conf -state normal + $w image create $lno.0 \ + -align center -padx 5 -pady 1 \ + -name $icon_name \ + -image [mapicon $w $new_m $path] + $w insert $lno.1 "[escape_path $path]\n" + $w conf -state disabled + } elseif {$old_m ne $new_m} { + $w conf -state normal + $w image conf $icon_name -image [mapicon $w $new_m $path] + $w conf -state disabled + } +} + +proc display_file {path state} { + global file_states selected_paths + global ui_index ui_workdir + + set old_m [merge_state $path $state] + set s $file_states($path) + set new_m [lindex $s 0] + set icon_name [lindex $s 1] + + set o [string index $old_m 0] + set n [string index $new_m 0] + if {$o eq {U}} { + set o _ + } + if {$n eq {U}} { + set n _ + } + display_file_helper $ui_index $path $icon_name $o $n + + if {[string index $old_m 0] eq {U}} { + set o U + } else { + set o [string index $old_m 1] + } + if {[string index $new_m 0] eq {U}} { + set n U + } else { + set n [string index $new_m 1] + } + display_file_helper $ui_workdir $path $icon_name $o $n + + if {$new_m eq {__}} { + unset file_states($path) + catch {unset selected_paths($path)} + } +} + +proc display_all_files_helper {w path icon_name m} { + global file_lists + + lappend file_lists($w) $path + set lno [expr {[lindex [split [$w index end] .] 0] - 1}] + $w image create end \ + -align center -padx 5 -pady 1 \ + -name $icon_name \ + -image [mapicon $w $m $path] + $w insert end "[escape_path $path]\n" +} + +proc display_all_files {} { + global ui_index ui_workdir + global file_states file_lists + global last_clicked + + $ui_index conf -state normal + $ui_workdir conf -state normal + + $ui_index delete 0.0 end + $ui_workdir delete 0.0 end + set last_clicked {} + + set file_lists($ui_index) [list] + set file_lists($ui_workdir) [list] + + foreach path [lsort [array names file_states]] { + set s $file_states($path) + set m [lindex $s 0] + set icon_name [lindex $s 1] + + set s [string index $m 0] + if {$s ne {U} && $s ne {_}} { + display_all_files_helper $ui_index $path \ + $icon_name $s + } + + if {[string index $m 0] eq {U}} { + set s U + } else { + set s [string index $m 1] + } + if {$s ne {_}} { + display_all_files_helper $ui_workdir $path \ + $icon_name $s + } + } + + $ui_index conf -state disabled + $ui_workdir conf -state disabled +} + +###################################################################### +## +## icons + +set filemask { +#define mask_width 14 +#define mask_height 15 +static unsigned char mask_bits[] = { + 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, + 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, + 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f}; +} + +image create bitmap file_plain -background white -foreground black -data { +#define plain_width 14 +#define plain_height 15 +static unsigned char plain_bits[] = { + 0xfe, 0x01, 0x02, 0x03, 0x02, 0x05, 0x02, 0x09, 0x02, 0x1f, 0x02, 0x10, + 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, + 0x02, 0x10, 0x02, 0x10, 0xfe, 0x1f}; +} -maskdata $filemask + +image create bitmap file_mod -background white -foreground blue -data { +#define mod_width 14 +#define mod_height 15 +static unsigned char mod_bits[] = { + 0xfe, 0x01, 0x02, 0x03, 0x7a, 0x05, 0x02, 0x09, 0x7a, 0x1f, 0x02, 0x10, + 0xfa, 0x17, 0x02, 0x10, 0xfa, 0x17, 0x02, 0x10, 0xfa, 0x17, 0x02, 0x10, + 0xfa, 0x17, 0x02, 0x10, 0xfe, 0x1f}; +} -maskdata $filemask + +image create bitmap file_fulltick -background white -foreground "#007000" -data { +#define file_fulltick_width 14 +#define file_fulltick_height 15 +static unsigned char file_fulltick_bits[] = { + 0xfe, 0x01, 0x02, 0x1a, 0x02, 0x0c, 0x02, 0x0c, 0x02, 0x16, 0x02, 0x16, + 0x02, 0x13, 0x00, 0x13, 0x86, 0x11, 0x8c, 0x11, 0xd8, 0x10, 0xf2, 0x10, + 0x62, 0x10, 0x02, 0x10, 0xfe, 0x1f}; +} -maskdata $filemask + +image create bitmap file_parttick -background white -foreground "#005050" -data { +#define parttick_width 14 +#define parttick_height 15 +static unsigned char parttick_bits[] = { + 0xfe, 0x01, 0x02, 0x03, 0x7a, 0x05, 0x02, 0x09, 0x7a, 0x1f, 0x02, 0x10, + 0x7a, 0x14, 0x02, 0x16, 0x02, 0x13, 0x8a, 0x11, 0xda, 0x10, 0x72, 0x10, + 0x22, 0x10, 0x02, 0x10, 0xfe, 0x1f}; +} -maskdata $filemask + +image create bitmap file_question -background white -foreground black -data { +#define file_question_width 14 +#define file_question_height 15 +static unsigned char file_question_bits[] = { + 0xfe, 0x01, 0x02, 0x02, 0xe2, 0x04, 0xf2, 0x09, 0x1a, 0x1b, 0x0a, 0x13, + 0x82, 0x11, 0xc2, 0x10, 0x62, 0x10, 0x62, 0x10, 0x02, 0x10, 0x62, 0x10, + 0x62, 0x10, 0x02, 0x10, 0xfe, 0x1f}; +} -maskdata $filemask + +image create bitmap file_removed -background white -foreground red -data { +#define file_removed_width 14 +#define file_removed_height 15 +static unsigned char file_removed_bits[] = { + 0xfe, 0x01, 0x02, 0x03, 0x02, 0x05, 0x02, 0x09, 0x02, 0x1f, 0x02, 0x10, + 0x1a, 0x16, 0x32, 0x13, 0xe2, 0x11, 0xc2, 0x10, 0xe2, 0x11, 0x32, 0x13, + 0x1a, 0x16, 0x02, 0x10, 0xfe, 0x1f}; +} -maskdata $filemask + +image create bitmap file_merge -background white -foreground blue -data { +#define file_merge_width 14 +#define file_merge_height 15 +static unsigned char file_merge_bits[] = { + 0xfe, 0x01, 0x02, 0x03, 0x62, 0x05, 0x62, 0x09, 0x62, 0x1f, 0x62, 0x10, + 0xfa, 0x11, 0xf2, 0x10, 0x62, 0x10, 0x02, 0x10, 0xfa, 0x17, 0x02, 0x10, + 0xfa, 0x17, 0x02, 0x10, 0xfe, 0x1f}; +} -maskdata $filemask + +set ui_index .vpane.files.index.list +set ui_workdir .vpane.files.workdir.list + +set all_icons(_$ui_index) file_plain +set all_icons(A$ui_index) file_fulltick +set all_icons(M$ui_index) file_fulltick +set all_icons(D$ui_index) file_removed +set all_icons(U$ui_index) file_merge + +set all_icons(_$ui_workdir) file_plain +set all_icons(M$ui_workdir) file_mod +set all_icons(D$ui_workdir) file_question +set all_icons(U$ui_workdir) file_merge +set all_icons(O$ui_workdir) file_plain + +set max_status_desc 0 +foreach i { + {__ {mc "Unmodified"}} + + {_M {mc "Modified, not staged"}} + {M_ {mc "Staged for commit"}} + {MM {mc "Portions staged for commit"}} + {MD {mc "Staged for commit, missing"}} + + {_O {mc "Untracked, not staged"}} + {A_ {mc "Staged for commit"}} + {AM {mc "Portions staged for commit"}} + {AD {mc "Staged for commit, missing"}} + + {_D {mc "Missing"}} + {D_ {mc "Staged for removal"}} + {DO {mc "Staged for removal, still present"}} + + {U_ {mc "Requires merge resolution"}} + {UU {mc "Requires merge resolution"}} + {UM {mc "Requires merge resolution"}} + {UD {mc "Requires merge resolution"}} + } { + set text [eval [lindex $i 1]] + if {$max_status_desc < [string length $text]} { + set max_status_desc [string length $text] + } + set all_descs([lindex $i 0]) $text +} +unset i + +###################################################################### +## +## util + +proc scrollbar2many {list mode args} { + foreach w $list {eval $w $mode $args} +} + +proc many2scrollbar {list mode sb top bottom} { + $sb set $top $bottom + foreach w $list {$w $mode moveto $top} +} + +proc incr_font_size {font {amt 1}} { + set sz [font configure $font -size] + incr sz $amt + font configure $font -size $sz + font configure ${font}bold -size $sz + font configure ${font}italic -size $sz +} + +###################################################################### +## +## ui commands + +set starting_gitk_msg [mc "Starting gitk... please wait..."] + +proc do_gitk {revs} { + # -- Always start gitk through whatever we were loaded with. This + # lets us bypass using shell process on Windows systems. + # + set exe [_which gitk -script] + set cmd [list [info nameofexecutable] $exe] + if {$exe eq {}} { + error_popup [mc "Couldn't find gitk in PATH"] + } else { + global env + + if {[info exists env(GIT_DIR)]} { + set old_GIT_DIR $env(GIT_DIR) + } else { + set old_GIT_DIR {} + } + + set pwd [pwd] + cd [file dirname [gitdir]] + set env(GIT_DIR) [file tail [gitdir]] + + eval exec $cmd $revs & + + if {$old_GIT_DIR eq {}} { + unset env(GIT_DIR) + } else { + set env(GIT_DIR) $old_GIT_DIR + } + cd $pwd + + ui_status $::starting_gitk_msg + after 10000 { + ui_ready $starting_gitk_msg + } + } +} + +set is_quitting 0 + +proc do_quit {} { + global ui_comm is_quitting repo_config commit_type + global GITGUI_BCK_exists GITGUI_BCK_i + global ui_comm_spell + + if {$is_quitting} return + set is_quitting 1 + + if {[winfo exists $ui_comm]} { + # -- Stash our current commit buffer. + # + set save [gitdir GITGUI_MSG] + if {$GITGUI_BCK_exists && ![$ui_comm edit modified]} { + file rename -force [gitdir GITGUI_BCK] $save + set GITGUI_BCK_exists 0 + } else { + set msg [string trim [$ui_comm get 0.0 end]] + regsub -all -line {[ \r\t]+$} $msg {} msg + if {(![string match amend* $commit_type] + || [$ui_comm edit modified]) + && $msg ne {}} { + catch { + set fd [open $save w] + puts -nonewline $fd $msg + close $fd + } + } else { + catch {file delete $save} + } + } + + # -- Cancel our spellchecker if its running. + # + if {[info exists ui_comm_spell]} { + $ui_comm_spell stop + } + + # -- Remove our editor backup, its not needed. + # + after cancel $GITGUI_BCK_i + if {$GITGUI_BCK_exists} { + catch {file delete [gitdir GITGUI_BCK]} + } + + # -- Stash our current window geometry into this repository. + # + set cfg_geometry [list] + lappend cfg_geometry [wm geometry .] + lappend cfg_geometry [lindex [.vpane sash coord 0] 0] + lappend cfg_geometry [lindex [.vpane.files sash coord 0] 1] + if {[catch {set rc_geometry $repo_config(gui.geometry)}]} { + set rc_geometry {} + } + if {$cfg_geometry ne $rc_geometry} { + catch {git config gui.geometry $cfg_geometry} + } + } + + destroy . +} + +proc do_rescan {} { + rescan ui_ready +} + +proc do_commit {} { + commit_tree +} + +proc next_diff {} { + global next_diff_p next_diff_w next_diff_i + show_diff $next_diff_p $next_diff_w $next_diff_i +} + +proc toggle_or_diff {w x y} { + 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] + set path [lindex $file_lists($w) [expr {$lno - 1}]] + if {$path eq {}} { + set last_clicked {} + return + } + + set last_clicked [list $w $lno] + array unset selected_paths + $ui_index tag remove in_sel 0.0 end + $ui_workdir tag remove in_sel 0.0 end + + if {$col == 0 && $y > 1} { + set i [expr {$lno-1}] + set ll [expr {[llength $file_lists($w)]-1}] + + if {$i == $ll && $i == 0} { + set after {reshow_diff;} + } else { + global next_diff_p next_diff_w next_diff_i + + set next_diff_w $w + + if {$i < $ll} { + set i [expr {$i + 1}] + set next_diff_i $i + } else { + set next_diff_i $i + set i [expr {$i - 1}] + } + + set next_diff_p [lindex $file_lists($w) $i] + + if {$next_diff_p ne {} && $current_diff_path ne {}} { + set after {next_diff;} + } else { + set after {} + } + } + + if {$w eq $ui_index} { + update_indexinfo \ + "Unstaging [short_path $path] from commit" \ + [list $path] \ + [concat $after [list ui_ready]] + } elseif {$w eq $ui_workdir} { + update_index \ + "Adding [short_path $path]" \ + [list $path] \ + [concat $after [list ui_ready]] + } + } else { + show_diff $path $w $lno + } +} + +proc add_one_to_selection {w x y} { + global file_lists last_clicked selected_paths + + set lno [lindex [split [$w index @$x,$y] .] 0] + set path [lindex $file_lists($w) [expr {$lno - 1}]] + if {$path eq {}} { + set last_clicked {} + return + } + + if {$last_clicked ne {} + && [lindex $last_clicked 0] ne $w} { + array unset selected_paths + [lindex $last_clicked 0] tag remove in_sel 0.0 end + } + + set last_clicked [list $w $lno] + if {[catch {set in_sel $selected_paths($path)}]} { + set in_sel 0 + } + if {$in_sel} { + unset selected_paths($path) + $w tag remove in_sel $lno.0 [expr {$lno + 1}].0 + } else { + set selected_paths($path) 1 + $w tag add in_sel $lno.0 [expr {$lno + 1}].0 + } +} + +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 + return + } + + set lno [lindex [split [$w index @$x,$y] .] 0] + set lc [lindex $last_clicked 1] + if {$lc < $lno} { + set begin $lc + set end $lno + } else { + set begin $lno + set end $lc + } + + foreach path [lrange $file_lists($w) \ + [expr {$begin - 1}] \ + [expr {$end - 1}]] { + set selected_paths($path) 1 + } + $w tag add in_sel $begin.0 [expr {$end + 1}].0 +} + +proc show_more_context {} { + global repo_config + if {$repo_config(gui.diffcontext) < 99} { + incr repo_config(gui.diffcontext) + reshow_diff + } +} + +proc show_less_context {} { + global repo_config - if {$repo_config(gui.diffcontext) >= 1} { ++ if {$repo_config(gui.diffcontext) > 1} { + incr repo_config(gui.diffcontext) -1 + reshow_diff + } +} + +###################################################################### +## +## ui construction + +load_config 0 +apply_config +set ui_comm {} + +# -- Menu Bar +# +menu .mbar -tearoff 0 +.mbar add cascade -label [mc Repository] -menu .mbar.repository +.mbar add cascade -label [mc Edit] -menu .mbar.edit +if {[is_enabled branch]} { + .mbar add cascade -label [mc Branch] -menu .mbar.branch +} +if {[is_enabled multicommit] || [is_enabled singlecommit]} { + .mbar add cascade -label [mc Commit@@noun] -menu .mbar.commit +} +if {[is_enabled transport]} { + .mbar add cascade -label [mc Merge] -menu .mbar.merge + .mbar add cascade -label [mc Remote] -menu .mbar.remote +} +. configure -menu .mbar + +# -- Repository Menu +# +menu .mbar.repository + +.mbar.repository add command \ + -label [mc "Browse Current Branch's Files"] \ + -command {browser::new $current_branch} +set ui_browse_current [.mbar.repository index last] +.mbar.repository add command \ + -label [mc "Browse Branch Files..."] \ + -command browser_open::dialog +.mbar.repository add separator + +.mbar.repository add command \ + -label [mc "Visualize Current Branch's History"] \ + -command {do_gitk $current_branch} +set ui_visualize_current [.mbar.repository index last] +.mbar.repository add command \ + -label [mc "Visualize All Branch History"] \ + -command {do_gitk --all} +.mbar.repository add separator + +proc current_branch_write {args} { + global current_branch + .mbar.repository entryconf $::ui_browse_current \ + -label [mc "Browse %s's Files" $current_branch] + .mbar.repository entryconf $::ui_visualize_current \ + -label [mc "Visualize %s's History" $current_branch] +} +trace add variable current_branch write current_branch_write + +if {[is_enabled multicommit]} { + .mbar.repository add command -label [mc "Database Statistics"] \ + -command do_stats + + .mbar.repository add command -label [mc "Compress Database"] \ + -command do_gc + + .mbar.repository add command -label [mc "Verify Database"] \ + -command do_fsck_objects + + .mbar.repository add separator + + if {[is_Cygwin]} { + .mbar.repository add command \ + -label [mc "Create Desktop Icon"] \ + -command do_cygwin_shortcut + } elseif {[is_Windows]} { + .mbar.repository add command \ + -label [mc "Create Desktop Icon"] \ + -command do_windows_shortcut + } elseif {[is_MacOSX]} { + .mbar.repository add command \ + -label [mc "Create Desktop Icon"] \ + -command do_macosx_app + } +} + +if {[is_MacOSX]} { + proc ::tk::mac::Quit {args} { do_quit } +} else { + .mbar.repository add command -label [mc Quit] \ + -command do_quit \ + -accelerator $M1T-Q +} + +# -- Edit Menu +# +menu .mbar.edit +.mbar.edit add command -label [mc Undo] \ + -command {catch {[focus] edit undo}} \ + -accelerator $M1T-Z +.mbar.edit add command -label [mc Redo] \ + -command {catch {[focus] edit redo}} \ + -accelerator $M1T-Y +.mbar.edit add separator +.mbar.edit add command -label [mc Cut] \ + -command {catch {tk_textCut [focus]}} \ + -accelerator $M1T-X +.mbar.edit add command -label [mc Copy] \ + -command {catch {tk_textCopy [focus]}} \ + -accelerator $M1T-C +.mbar.edit add command -label [mc Paste] \ + -command {catch {tk_textPaste [focus]; [focus] see insert}} \ + -accelerator $M1T-V +.mbar.edit add command -label [mc Delete] \ + -command {catch {[focus] delete sel.first sel.last}} \ + -accelerator Del +.mbar.edit add separator +.mbar.edit add command -label [mc "Select All"] \ + -command {catch {[focus] tag add sel 0.0 end}} \ + -accelerator $M1T-A + +# -- Branch Menu +# +if {[is_enabled branch]} { + menu .mbar.branch + + .mbar.branch add command -label [mc "Create..."] \ + -command branch_create::dialog \ + -accelerator $M1T-N + lappend disable_on_lock [list .mbar.branch entryconf \ + [.mbar.branch index last] -state] + + .mbar.branch add command -label [mc "Checkout..."] \ + -command branch_checkout::dialog \ + -accelerator $M1T-O + lappend disable_on_lock [list .mbar.branch entryconf \ + [.mbar.branch index last] -state] + + .mbar.branch add command -label [mc "Rename..."] \ + -command branch_rename::dialog + lappend disable_on_lock [list .mbar.branch entryconf \ + [.mbar.branch index last] -state] + + .mbar.branch add command -label [mc "Delete..."] \ + -command branch_delete::dialog + lappend disable_on_lock [list .mbar.branch entryconf \ + [.mbar.branch index last] -state] + + .mbar.branch add command -label [mc "Reset..."] \ + -command merge::reset_hard + lappend disable_on_lock [list .mbar.branch entryconf \ + [.mbar.branch index last] -state] +} + +# -- Commit Menu +# +if {[is_enabled multicommit] || [is_enabled singlecommit]} { + menu .mbar.commit + + .mbar.commit add radiobutton \ + -label [mc "New Commit"] \ + -command do_select_commit_type \ + -variable selected_commit_type \ + -value new + lappend disable_on_lock \ + [list .mbar.commit entryconf [.mbar.commit index last] -state] + + .mbar.commit add radiobutton \ + -label [mc "Amend Last Commit"] \ + -command do_select_commit_type \ + -variable selected_commit_type \ + -value amend + lappend disable_on_lock \ + [list .mbar.commit entryconf [.mbar.commit index last] -state] + + .mbar.commit add separator + + .mbar.commit add command -label [mc Rescan] \ + -command do_rescan \ + -accelerator F5 + lappend disable_on_lock \ + [list .mbar.commit entryconf [.mbar.commit index last] -state] + + .mbar.commit add command -label [mc "Stage To Commit"] \ + -command do_add_selection \ + -accelerator $M1T-T + lappend disable_on_lock \ + [list .mbar.commit entryconf [.mbar.commit index last] -state] + + .mbar.commit add command -label [mc "Stage Changed Files To Commit"] \ + -command do_add_all \ + -accelerator $M1T-I + lappend disable_on_lock \ + [list .mbar.commit entryconf [.mbar.commit index last] -state] + + .mbar.commit add command -label [mc "Unstage From Commit"] \ + -command do_unstage_selection + lappend disable_on_lock \ + [list .mbar.commit entryconf [.mbar.commit index last] -state] + + .mbar.commit add command -label [mc "Revert Changes"] \ + -command do_revert_selection + lappend disable_on_lock \ + [list .mbar.commit entryconf [.mbar.commit index last] -state] + + .mbar.commit add separator + + .mbar.commit add command -label [mc "Show Less Context"] \ + -command show_less_context \ + -accelerator $M1T-\- + + .mbar.commit add command -label [mc "Show More Context"] \ + -command show_more_context \ + -accelerator $M1T-= + + .mbar.commit add separator + + .mbar.commit add command -label [mc "Sign Off"] \ + -command do_signoff \ + -accelerator $M1T-S + + .mbar.commit add command -label [mc Commit@@verb] \ + -command do_commit \ + -accelerator $M1T-Return + lappend disable_on_lock \ + [list .mbar.commit entryconf [.mbar.commit index last] -state] +} + +# -- Merge Menu +# +if {[is_enabled branch]} { + menu .mbar.merge + .mbar.merge add command -label [mc "Local Merge..."] \ + -command merge::dialog \ + -accelerator $M1T-M + lappend disable_on_lock \ + [list .mbar.merge entryconf [.mbar.merge index last] -state] + .mbar.merge add command -label [mc "Abort Merge..."] \ + -command merge::reset_hard + lappend disable_on_lock \ + [list .mbar.merge entryconf [.mbar.merge index last] -state] +} + +# -- Transport Menu +# +if {[is_enabled transport]} { + menu .mbar.remote + + .mbar.remote add command \ + -label [mc "Push..."] \ + -command do_push_anywhere \ + -accelerator $M1T-P + .mbar.remote add command \ + -label [mc "Delete..."] \ + -command remote_branch_delete::dialog +} + +if {[is_MacOSX]} { + # -- Apple Menu (Mac OS X only) + # + .mbar add cascade -label Apple -menu .mbar.apple + menu .mbar.apple + + .mbar.apple add command -label [mc "About %s" [appname]] \ + -command do_about + .mbar.apple add separator + .mbar.apple add command \ + -label [mc "Preferences..."] \ + -command do_options \ + -accelerator $M1T-, + bind . <$M1B-,> do_options +} else { + # -- Edit Menu + # + .mbar.edit add separator + .mbar.edit add command -label [mc "Options..."] \ + -command do_options +} + +# -- Help Menu +# +.mbar add cascade -label [mc Help] -menu .mbar.help +menu .mbar.help + +if {![is_MacOSX]} { + .mbar.help add command -label [mc "About %s" [appname]] \ + -command do_about +} + +set browser {} +catch {set browser $repo_config(instaweb.browser)} +set doc_path [file dirname [gitexec]] +set doc_path [file join $doc_path Documentation index.html] + +if {[is_Cygwin]} { + set doc_path [exec cygpath --mixed $doc_path] +} + +if {$browser eq {}} { + if {[is_MacOSX]} { + set browser open + } elseif {[is_Cygwin]} { + set program_files [file dirname [exec cygpath --windir]] + set program_files [file join $program_files {Program Files}] + set firefox [file join $program_files {Mozilla Firefox} firefox.exe] + set ie [file join $program_files {Internet Explorer} IEXPLORE.EXE] + if {[file exists $firefox]} { + set browser $firefox + } elseif {[file exists $ie]} { + set browser $ie + } + unset program_files firefox ie + } +} + +if {[file isfile $doc_path]} { + set doc_url "file:$doc_path" +} else { + set doc_url {http://www.kernel.org/pub/software/scm/git/docs/} +} + +if {$browser ne {}} { + .mbar.help add command -label [mc "Online Documentation"] \ + -command [list exec $browser $doc_url &] +} +unset browser doc_path doc_url + +# -- Standard bindings +# +wm protocol . WM_DELETE_WINDOW do_quit +bind all <$M1B-Key-q> do_quit +bind all <$M1B-Key-Q> do_quit +bind all <$M1B-Key-w> {destroy [winfo toplevel %W]} +bind all <$M1B-Key-W> {destroy [winfo toplevel %W]} + +set subcommand_args {} +proc usage {} { + puts stderr "usage: $::argv0 $::subcommand $::subcommand_args" + exit 1 +} + +# -- Not a normal commit type invocation? Do that instead! +# +switch -- $subcommand { +browser - +blame { + set subcommand_args {rev? path} + if {$argv eq {}} usage + set head {} + set path {} + set is_path 0 + foreach a $argv { + if {$is_path || [file exists $_prefix$a]} { + if {$path ne {}} usage + set path $_prefix$a + break + } elseif {$a eq {--}} { + if {$path ne {}} { + if {$head ne {}} usage + set head $path + set path {} + } + set is_path 1 + } elseif {$head eq {}} { + if {$head ne {}} usage + set head $a + set is_path 1 + } else { + usage + } + } + unset is_path + + if {$head ne {} && $path eq {}} { + set path $_prefix$head + set head {} + } + + if {$head eq {}} { + load_current_branch + } else { + if {[regexp {^[0-9a-f]{1,39}$} $head]} { + if {[catch { + set head [git rev-parse --verify $head] + } err]} { + puts stderr $err + exit 1 + } + } + set current_branch $head + } + + switch -- $subcommand { + browser { + if {$head eq {}} { + if {$path ne {} && [file isdirectory $path]} { + set head $current_branch + } else { + set head $path + set path {} + } + } + browser::new $head $path + } + blame { + if {$head eq {} && ![file exists $path]} { + puts stderr [mc "fatal: cannot stat path %s: No such file or directory" $path] + exit 1 + } + blame::new $head $path + } + } + return +} +citool - +gui { + if {[llength $argv] != 0} { + puts -nonewline stderr "usage: $argv0" + if {$subcommand ne {gui} + && [file tail $argv0] ne "git-$subcommand"} { + puts -nonewline stderr " $subcommand" + } + puts stderr {} + exit 1 + } + # fall through to setup UI for commits +} +default { + puts stderr "usage: $argv0 \[{blame|browser|citool}\]" + exit 1 +} +} + +# -- Branch Control +# +frame .branch \ + -borderwidth 1 \ + -relief sunken +label .branch.l1 \ + -text [mc "Current Branch:"] \ + -anchor w \ + -justify left +label .branch.cb \ + -textvariable current_branch \ + -anchor w \ + -justify left +pack .branch.l1 -side left +pack .branch.cb -side left -fill x +pack .branch -side top -fill x + +# -- Main Window Layout +# +panedwindow .vpane -orient horizontal +panedwindow .vpane.files -orient vertical +.vpane add .vpane.files -sticky nsew -height 100 -width 200 +pack .vpane -anchor n -side top -fill both -expand 1 + +# -- Index File List +# +frame .vpane.files.index -height 100 -width 200 +label .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 +scrollbar .vpane.files.index.sx -orient h -command [list $ui_index xview] +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 +# +frame .vpane.files.workdir -height 100 -width 200 +label .vpane.files.workdir.title -text [mc "Unstaged Changes"] \ + -background lightsalmon -foreground black +text $ui_workdir -background white -foreground black \ + -borderwidth 0 \ + -width 20 -height 10 \ + -wrap none \ + -cursor $cursor_ptr \ + -xscrollcommand {.vpane.files.workdir.sx set} \ + -yscrollcommand {.vpane.files.workdir.sy set} \ + -state disabled +scrollbar .vpane.files.workdir.sx -orient h -command [list $ui_workdir xview] +scrollbar .vpane.files.workdir.sy -orient v -command [list $ui_workdir yview] +pack .vpane.files.workdir.title -side top -fill x +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 + +.vpane.files add .vpane.files.workdir -sticky nsew +.vpane.files add .vpane.files.index -sticky nsew + +foreach i [list $ui_index $ui_workdir] { + rmsel_tag $i + $i tag conf in_diff -background [$i tag cget in_sel -background] +} +unset i + +# -- Diff and Commit Area +# +frame .vpane.lower -height 300 -width 400 +frame .vpane.lower.commarea +frame .vpane.lower.diff -relief sunken -borderwidth 1 +pack .vpane.lower.diff -fill both -expand 1 +pack .vpane.lower.commarea -side bottom -fill x +.vpane add .vpane.lower -sticky nsew + +# -- Commit Area Buttons +# +frame .vpane.lower.commarea.buttons +label .vpane.lower.commarea.buttons.l -text {} \ + -anchor w \ + -justify left +pack .vpane.lower.commarea.buttons.l -side top -fill x +pack .vpane.lower.commarea.buttons -side left -fill y + +button .vpane.lower.commarea.buttons.rescan -text [mc Rescan] \ + -command do_rescan +pack .vpane.lower.commarea.buttons.rescan -side top -fill x +lappend disable_on_lock \ + {.vpane.lower.commarea.buttons.rescan conf -state} + +button .vpane.lower.commarea.buttons.incall -text [mc "Stage Changed"] \ + -command do_add_all +pack .vpane.lower.commarea.buttons.incall -side top -fill x +lappend disable_on_lock \ + {.vpane.lower.commarea.buttons.incall conf -state} + +button .vpane.lower.commarea.buttons.signoff -text [mc "Sign Off"] \ + -command do_signoff +pack .vpane.lower.commarea.buttons.signoff -side top -fill x + +button .vpane.lower.commarea.buttons.commit -text [mc Commit@@verb] \ + -command do_commit +pack .vpane.lower.commarea.buttons.commit -side top -fill x +lappend disable_on_lock \ + {.vpane.lower.commarea.buttons.commit conf -state} + +button .vpane.lower.commarea.buttons.push -text [mc Push] \ + -command do_push_anywhere +pack .vpane.lower.commarea.buttons.push -side top -fill x + +# -- Commit Message Buffer +# +frame .vpane.lower.commarea.buffer +frame .vpane.lower.commarea.buffer.header +set ui_comm .vpane.lower.commarea.buffer.t +set ui_coml .vpane.lower.commarea.buffer.header.l +radiobutton .vpane.lower.commarea.buffer.header.new \ + -text [mc "New Commit"] \ + -command do_select_commit_type \ + -variable selected_commit_type \ + -value new +lappend disable_on_lock \ + [list .vpane.lower.commarea.buffer.header.new conf -state] +radiobutton .vpane.lower.commarea.buffer.header.amend \ + -text [mc "Amend Last Commit"] \ + -command do_select_commit_type \ + -variable selected_commit_type \ + -value amend +lappend disable_on_lock \ + [list .vpane.lower.commarea.buffer.header.amend conf -state] +label $ui_coml \ + -anchor w \ + -justify left +proc trace_commit_type {varname args} { + global ui_coml commit_type + switch -glob -- $commit_type { + initial {set txt [mc "Initial Commit Message:"]} + amend {set txt [mc "Amended Commit Message:"]} + amend-initial {set txt [mc "Amended Initial Commit Message:"]} + amend-merge {set txt [mc "Amended Merge Commit Message:"]} + merge {set txt [mc "Merge Commit Message:"]} + * {set txt [mc "Commit Message:"]} + } + $ui_coml conf -text $txt +} +trace add variable commit_type write trace_commit_type +pack $ui_coml -side left -fill x +pack .vpane.lower.commarea.buffer.header.amend -side right +pack .vpane.lower.commarea.buffer.header.new -side right + +text $ui_comm -background white -foreground black \ + -borderwidth 1 \ + -undo true \ + -maxundo 20 \ + -autoseparators true \ + -relief sunken \ + -width $repo_config(gui.commitmsgwidth) -height 9 -wrap none \ + -font font_diff \ + -yscrollcommand {.vpane.lower.commarea.buffer.sby set} +scrollbar .vpane.lower.commarea.buffer.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 $ui_comm -side left -fill y +pack .vpane.lower.commarea.buffer -side left -fill y + +# -- Commit Message Buffer Context Menu +# +set ctxm .vpane.lower.commarea.buffer.ctxm +menu $ctxm -tearoff 0 +$ctxm add command \ + -label [mc Cut] \ + -command {tk_textCut $ui_comm} +$ctxm add command \ + -label [mc Copy] \ + -command {tk_textCopy $ui_comm} +$ctxm add command \ + -label [mc Paste] \ + -command {tk_textPaste $ui_comm} +$ctxm add command \ + -label [mc Delete] \ + -command {$ui_comm delete sel.first sel.last} +$ctxm add separator +$ctxm add command \ + -label [mc "Select All"] \ + -command {focus $ui_comm;$ui_comm tag add sel 0.0 end} +$ctxm add command \ + -label [mc "Copy All"] \ + -command { + $ui_comm tag add sel 0.0 end + tk_textCopy $ui_comm + $ui_comm tag remove sel 0.0 end + } +$ctxm add separator +$ctxm add command \ + -label [mc "Sign Off"] \ + -command do_signoff +set ui_comm_ctxm $ctxm + +# -- Diff Header +# +proc trace_current_diff_path {varname args} { + global current_diff_path diff_actions file_states + if {$current_diff_path eq {}} { + set s {} + set f {} + set p {} + set o disabled + } else { + set p $current_diff_path + set s [mapdesc [lindex $file_states($p) 0] $p] + set f [mc "File:"] + set p [escape_path $p] + set o normal + } + + .vpane.lower.diff.header.status configure -text $s + .vpane.lower.diff.header.file configure -text $f + .vpane.lower.diff.header.path configure -text $p + foreach w $diff_actions { + uplevel #0 $w $o + } +} +trace add variable current_diff_path write trace_current_diff_path + +frame .vpane.lower.diff.header -background gold +label .vpane.lower.diff.header.status \ + -background gold \ + -foreground black \ + -width $max_status_desc \ + -anchor w \ + -justify left +label .vpane.lower.diff.header.file \ + -background gold \ + -foreground black \ + -anchor w \ + -justify left +label .vpane.lower.diff.header.path \ + -background gold \ + -foreground black \ + -anchor w \ + -justify left +pack .vpane.lower.diff.header.status -side left +pack .vpane.lower.diff.header.file -side left +pack .vpane.lower.diff.header.path -fill x +set ctxm .vpane.lower.diff.header.ctxm +menu $ctxm -tearoff 0 +$ctxm add command \ + -label [mc Copy] \ + -command { + clipboard clear + clipboard append \ + -format STRING \ + -type STRING \ + -- $current_diff_path + } +lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state] +bind_button3 .vpane.lower.diff.header.path "tk_popup $ctxm %X %Y" + +# -- Diff Body +# +frame .vpane.lower.diff.body +set ui_diff .vpane.lower.diff.body.t +text $ui_diff -background white -foreground black \ + -borderwidth 0 \ + -width 80 -height 15 -wrap none \ + -font font_diff \ + -xscrollcommand {.vpane.lower.diff.body.sbx set} \ + -yscrollcommand {.vpane.lower.diff.body.sby set} \ + -state disabled +scrollbar .vpane.lower.diff.body.sbx -orient horizontal \ + -command [list $ui_diff xview] +scrollbar .vpane.lower.diff.body.sby -orient vertical \ + -command [list $ui_diff yview] +pack .vpane.lower.diff.body.sbx -side bottom -fill x +pack .vpane.lower.diff.body.sby -side right -fill y +pack $ui_diff -side left -fill both -expand 1 +pack .vpane.lower.diff.header -side top -fill x +pack .vpane.lower.diff.body -side bottom -fill both -expand 1 + +$ui_diff tag conf d_cr -elide true +$ui_diff tag conf d_@ -foreground blue -font font_diffbold +$ui_diff tag conf d_+ -foreground {#00a000} +$ui_diff tag conf d_- -foreground red + +$ui_diff tag conf d_++ -foreground {#00a000} +$ui_diff tag conf d_-- -foreground red +$ui_diff tag conf d_+s \ + -foreground {#00a000} \ + -background {#e2effa} +$ui_diff tag conf d_-s \ + -foreground red \ + -background {#e2effa} +$ui_diff tag conf d_s+ \ + -foreground {#00a000} \ + -background ivory1 +$ui_diff tag conf d_s- \ + -foreground red \ + -background ivory1 + +$ui_diff tag conf d<<<<<<< \ + -foreground orange \ + -font font_diffbold +$ui_diff tag conf d======= \ + -foreground orange \ + -font font_diffbold +$ui_diff tag conf d>>>>>>> \ + -foreground orange \ + -font font_diffbold + +$ui_diff tag raise sel + +# -- Diff Body Context Menu +# +set ctxm .vpane.lower.diff.body.ctxm +menu $ctxm -tearoff 0 +$ctxm add command \ + -label [mc "Apply/Reverse Hunk"] \ + -command {apply_hunk $cursorX $cursorY} +set ui_diff_applyhunk [$ctxm index last] +lappend diff_actions [list $ctxm entryconf $ui_diff_applyhunk -state] +$ctxm add command \ + -label [mc "Apply/Reverse Line"] \ + -command {apply_line $cursorX $cursorY; do_rescan} +set ui_diff_applyline [$ctxm index last] +lappend diff_actions [list $ctxm entryconf $ui_diff_applyline -state] +$ctxm add separator +$ctxm add command \ + -label [mc "Show Less Context"] \ + -command show_less_context +lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state] +$ctxm add command \ + -label [mc "Show More Context"] \ + -command show_more_context +lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state] +$ctxm add separator +$ctxm add command \ + -label [mc Refresh] \ + -command reshow_diff +lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state] +$ctxm add command \ + -label [mc Copy] \ + -command {tk_textCopy $ui_diff} +lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state] +$ctxm add command \ + -label [mc "Select All"] \ + -command {focus $ui_diff;$ui_diff tag add sel 0.0 end} +lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state] +$ctxm add command \ + -label [mc "Copy All"] \ + -command { + $ui_diff tag add sel 0.0 end + tk_textCopy $ui_diff + $ui_diff tag remove sel 0.0 end + } +lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state] +$ctxm add separator +$ctxm add command \ + -label [mc "Decrease Font Size"] \ + -command {incr_font_size font_diff -1} +lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state] +$ctxm add command \ + -label [mc "Increase Font Size"] \ + -command {incr_font_size font_diff 1} +lappend diff_actions [list $ctxm entryconf [$ctxm index last] -state] +$ctxm add separator +$ctxm add command -label [mc "Options..."] \ + -command do_options +proc popup_diff_menu {ctxm x y X Y} { + global current_diff_path file_states + set ::cursorX $x + set ::cursorY $y + if {$::ui_index eq $::current_diff_side} { + set l [mc "Unstage Hunk From Commit"] + set t [mc "Unstage Line From Commit"] + } else { + set l [mc "Stage Hunk For Commit"] + set t [mc "Stage Line For Commit"] + } + if {$::is_3way_diff + || $current_diff_path eq {} + || ![info exists file_states($current_diff_path)] + || {_O} eq [lindex $file_states($current_diff_path) 0]} { + set s disabled + } else { + set s normal + } + $ctxm entryconf $::ui_diff_applyhunk -state $s -label $l + $ctxm entryconf $::ui_diff_applyline -state $s -label $t + tk_popup $ctxm $X $Y +} +bind_button3 $ui_diff [list popup_diff_menu $ctxm %x %y %X %Y] + +# -- Status Bar +# +set main_status [::status_bar::new .status] +pack .status -anchor w -side bottom -fill x +$main_status show [mc "Initializing..."] + +# -- Load geometry +# +catch { +set gm $repo_config(gui.geometry) +wm geometry . [lindex $gm 0] +.vpane sash place 0 \ + [lindex $gm 1] \ + [lindex [.vpane sash coord 0] 1] +.vpane.files sash place 0 \ + [lindex [.vpane.files sash coord 0] 0] \ + [lindex $gm 2] +unset gm +} + +# -- Key Bindings +# +bind $ui_comm <$M1B-Key-Return> {do_commit;break} +bind $ui_comm <$M1B-Key-t> {do_add_selection;break} +bind $ui_comm <$M1B-Key-T> {do_add_selection;break} +bind $ui_comm <$M1B-Key-i> {do_add_all;break} +bind $ui_comm <$M1B-Key-I> {do_add_all;break} +bind $ui_comm <$M1B-Key-x> {tk_textCut %W;break} +bind $ui_comm <$M1B-Key-X> {tk_textCut %W;break} +bind $ui_comm <$M1B-Key-c> {tk_textCopy %W;break} +bind $ui_comm <$M1B-Key-C> {tk_textCopy %W;break} +bind $ui_comm <$M1B-Key-v> {tk_textPaste %W; %W see insert; break} +bind $ui_comm <$M1B-Key-V> {tk_textPaste %W; %W see insert; break} +bind $ui_comm <$M1B-Key-a> {%W tag add sel 0.0 end;break} +bind $ui_comm <$M1B-Key-A> {%W tag add sel 0.0 end;break} +bind $ui_comm <$M1B-Key-minus> {show_less_context;break} +bind $ui_comm <$M1B-Key-KP_Subtract> {show_less_context;break} +bind $ui_comm <$M1B-Key-equal> {show_more_context;break} +bind $ui_comm <$M1B-Key-plus> {show_more_context;break} +bind $ui_comm <$M1B-Key-KP_Add> {show_more_context;break} + +bind $ui_diff <$M1B-Key-x> {tk_textCopy %W;break} +bind $ui_diff <$M1B-Key-X> {tk_textCopy %W;break} +bind $ui_diff <$M1B-Key-c> {tk_textCopy %W;break} +bind $ui_diff <$M1B-Key-C> {tk_textCopy %W;break} +bind $ui_diff <$M1B-Key-v> {break} +bind $ui_diff <$M1B-Key-V> {break} +bind $ui_diff <$M1B-Key-a> {%W tag add sel 0.0 end;break} +bind $ui_diff <$M1B-Key-A> {%W tag add sel 0.0 end;break} +bind $ui_diff {catch {%W yview scroll -1 units};break} +bind $ui_diff {catch {%W yview scroll 1 units};break} +bind $ui_diff {catch {%W xview scroll -1 units};break} +bind $ui_diff {catch {%W xview scroll 1 units};break} +bind $ui_diff {catch {%W yview scroll -1 units};break} +bind $ui_diff {catch {%W yview scroll 1 units};break} +bind $ui_diff {catch {%W xview scroll -1 units};break} +bind $ui_diff {catch {%W xview scroll 1 units};break} +bind $ui_diff {catch {%W yview scroll -1 pages};break} +bind $ui_diff {catch {%W yview scroll 1 pages};break} +bind $ui_diff {focus %W} + +if {[is_enabled branch]} { + bind . <$M1B-Key-n> branch_create::dialog + bind . <$M1B-Key-N> branch_create::dialog + bind . <$M1B-Key-o> branch_checkout::dialog + bind . <$M1B-Key-O> branch_checkout::dialog + bind . <$M1B-Key-m> merge::dialog + bind . <$M1B-Key-M> merge::dialog +} +if {[is_enabled transport]} { + bind . <$M1B-Key-p> do_push_anywhere + bind . <$M1B-Key-P> do_push_anywhere +} + +bind . do_rescan +bind . <$M1B-Key-r> do_rescan +bind . <$M1B-Key-R> 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-i> do_add_all +bind . <$M1B-Key-I> do_add_all +bind . <$M1B-Key-minus> {show_less_context;break} +bind . <$M1B-Key-KP_Subtract> {show_less_context;break} +bind . <$M1B-Key-equal> {show_more_context;break} +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 "toggle_or_diff $i %x %y; break" + bind $i <$M1B-Button-1> "add_one_to_selection $i %x %y; break" + bind $i "add_range_to_selection $i %x %y; break" +} +unset i + +set file_lists($ui_index) [list] +set file_lists($ui_workdir) [list] + +wm title . "[appname] ([reponame]) [file normalize [file dirname [gitdir]]]" +focus -force $ui_comm + +# -- Warn the user about environmental problems. Cygwin's Tcl +# does *not* pass its env array onto any processes it spawns. +# This means that git processes get none of our environment. +# +if {[is_Cygwin]} { + set ignored_env 0 + set suggest_user {} + set msg [mc "Possible environment issues exist. + +The following environment variables are probably +going to be ignored by any Git subprocess run +by %s: + +" [appname]] + foreach name [array names env] { + switch -regexp -- $name { + {^GIT_INDEX_FILE$} - + {^GIT_OBJECT_DIRECTORY$} - + {^GIT_ALTERNATE_OBJECT_DIRECTORIES$} - + {^GIT_DIFF_OPTS$} - + {^GIT_EXTERNAL_DIFF$} - + {^GIT_PAGER$} - + {^GIT_TRACE$} - + {^GIT_CONFIG$} - + {^GIT_CONFIG_LOCAL$} - + {^GIT_(AUTHOR|COMMITTER)_DATE$} { + append msg " - $name\n" + incr ignored_env + } + {^GIT_(AUTHOR|COMMITTER)_(NAME|EMAIL)$} { + append msg " - $name\n" + incr ignored_env + set suggest_user $name + } + } + } + if {$ignored_env > 0} { + append msg [mc " +This is due to a known issue with the +Tcl binary distributed by Cygwin."] + + if {$suggest_user ne {}} { + append msg [mc " + +A good replacement for %s +is placing values for the user.name and +user.email settings into your personal +~/.gitconfig file. +" $suggest_user] + } + warn_popup $msg + } + unset ignored_env msg suggest_user name +} + +# -- Only initialize complex UI if we are going to stay running. +# +if {[is_enabled transport]} { + load_all_remotes + + set n [.mbar.remote index end] + populate_push_menu + populate_fetch_menu + set n [expr {[.mbar.remote index end] - $n}] + if {$n > 0} { + if {[.mbar.remote type 0] eq "tearoff"} { incr n } + .mbar.remote insert $n separator + } + unset n +} + +if {[winfo exists $ui_comm]} { + set GITGUI_BCK_exists [load_message GITGUI_BCK] + + # -- If both our backup and message files exist use the + # newer of the two files to initialize the buffer. + # + if {$GITGUI_BCK_exists} { + set m [gitdir GITGUI_MSG] + if {[file isfile $m]} { + if {[file mtime [gitdir GITGUI_BCK]] > [file mtime $m]} { + catch {file delete [gitdir GITGUI_MSG]} + } else { + $ui_comm delete 0.0 end + $ui_comm edit reset + $ui_comm edit modified false + catch {file delete [gitdir GITGUI_BCK]} + set GITGUI_BCK_exists 0 + } + } + unset m + } + + proc backup_commit_buffer {} { + global ui_comm GITGUI_BCK_exists + + set m [$ui_comm edit modified] + if {$m || $GITGUI_BCK_exists} { + set msg [string trim [$ui_comm get 0.0 end]] + regsub -all -line {[ \r\t]+$} $msg {} msg + + if {$msg eq {}} { + if {$GITGUI_BCK_exists} { + catch {file delete [gitdir GITGUI_BCK]} + set GITGUI_BCK_exists 0 + } + } elseif {$m} { + catch { + set fd [open [gitdir GITGUI_BCK] w] + puts -nonewline $fd $msg + close $fd + set GITGUI_BCK_exists 1 + } + } + + $ui_comm edit modified false + } + + set ::GITGUI_BCK_i [after 2000 backup_commit_buffer] + } + + backup_commit_buffer + + # -- If the user has aspell available we can drive it + # in pipe mode to spellcheck the commit message. + # + set spell_cmd [list |] + set spell_dict [get_config gui.spellingdictionary] + lappend spell_cmd aspell + if {$spell_dict ne {}} { + lappend spell_cmd --master=$spell_dict + } + lappend spell_cmd --mode=none + lappend spell_cmd --encoding=utf-8 + lappend spell_cmd pipe + if {$spell_dict eq {none} + || [catch {set spell_fd [open $spell_cmd r+]} spell_err]} { + bind_button3 $ui_comm [list tk_popup $ui_comm_ctxm %X %Y] + } else { + set ui_comm_spell [spellcheck::init \ + $spell_fd \ + $ui_comm \ + $ui_comm_ctxm \ + ] + } + unset -nocomplain spell_cmd spell_fd spell_err spell_dict +} + +lock_index begin-read +if {![winfo ismapped .]} { + wm deiconify . +} +after 1 do_rescan +if {[is_enabled multicommit]} { + after 1000 hint_gc +} diff --cc git-gui/lib/diff.tcl index 52b79e4a1,000000000..1970b601e mode 100644,000000..100644 --- a/git-gui/lib/diff.tcl +++ b/git-gui/lib/diff.tcl @@@ -1,519 -1,0 +1,523 @@@ +# git-gui diff viewer +# Copyright (C) 2006, 2007 Shawn Pearce + +proc clear_diff {} { + global ui_diff current_diff_path current_diff_header + global ui_index ui_workdir + + $ui_diff conf -state normal + $ui_diff delete 0.0 end + $ui_diff conf -state disabled + + set current_diff_path {} + set current_diff_header {} + + $ui_index tag remove in_diff 0.0 end + $ui_workdir tag remove in_diff 0.0 end +} + +proc reshow_diff {} { + global file_states file_lists + global current_diff_path current_diff_side + global ui_diff + + set p $current_diff_path + if {$p eq {}} { + # No diff is being shown. + } elseif {$current_diff_side eq {} + || [catch {set s $file_states($p)}] + || [lsearch -sorted -exact $file_lists($current_diff_side) $p] == -1} { + clear_diff + } else { + set save_pos [lindex [$ui_diff yview] 0] + show_diff $p $current_diff_side {} $save_pos + } +} + +proc handle_empty_diff {} { + global current_diff_path file_states file_lists + + set path $current_diff_path + set s $file_states($path) + if {[lindex $s 0] ne {_M}} return + + info_popup [mc "No differences detected. + +%s has no changes. + +The modification date of this file was updated by another application, but the content within the file was not changed. + +A rescan will be automatically started to find other files which may have the same state." [short_path $path]] + + clear_diff + display_file $path __ + rescan ui_ready 0 +} + +proc show_diff {path w {lno {}} {scroll_pos {}}} { + global file_states file_lists + global is_3way_diff diff_active repo_config + global ui_diff ui_index ui_workdir + global current_diff_path current_diff_side current_diff_header + + if {$diff_active || ![lock_index read]} return + + clear_diff + if {$lno == {}} { + set lno [lsearch -sorted -exact $file_lists($w) $path] + if {$lno >= 0} { + incr lno + } + } + if {$lno >= 1} { + $w tag add in_diff $lno.0 [expr {$lno + 1}].0 + } + + set s $file_states($path) + set m [lindex $s 0] + set is_3way_diff 0 + set diff_active 1 + set current_diff_path $path + set current_diff_side $w + set current_diff_header {} + ui_status [mc "Loading diff of %s..." [escape_path $path]] + + # - Git won't give us the diff, there's nothing to compare to! + # + if {$m eq {_O}} { + set max_sz [expr {128 * 1024}] + set type unknown + if {[catch { + set type [file type $path] + switch -- $type { + directory { + set type submodule + set content {} + set sz 0 + } + link { + set content [file readlink $path] + set sz [string length $content] + } + file { + set fd [open $path r] + fconfigure $fd -eofchar {} + set content [read $fd $max_sz] + close $fd + set sz [file size $path] + } + default { + error "'$type' not supported" + } + } + } err ]} { + set diff_active 0 + unlock_index + ui_status [mc "Unable to display %s" [escape_path $path]] + error_popup [strcat [mc "Error loading file:"] "\n\n$err"] + return + } + $ui_diff conf -state normal + if {$type eq {submodule}} { + $ui_diff insert end [append \ + "* " \ + [mc "Git Repository (subproject)"] \ + "\n"] d_@ + } elseif {![catch {set type [exec file $path]}]} { + set n [string length $path] + if {[string equal -length $n $path $type]} { + set type [string range $type $n end] + regsub {^:?\s*} $type {} type + } + $ui_diff insert end "* $type\n" d_@ + } + if {[string first "\0" $content] != -1} { + $ui_diff insert end \ + [mc "* Binary file (not showing content)."] \ + d_@ + } else { + if {$sz > $max_sz} { + $ui_diff insert end \ +"* Untracked file is $sz bytes. +* Showing only first $max_sz bytes. +" d_@ + } + $ui_diff insert end $content + if {$sz > $max_sz} { + $ui_diff insert end " +* Untracked file clipped here by [appname]. +* To see the entire file, use an external editor. +" d_@ + } + } + $ui_diff conf -state disabled + set diff_active 0 + unlock_index + if {$scroll_pos ne {}} { + update + $ui_diff yview moveto $scroll_pos + } + ui_ready + return + } + + set cmd [list] + if {$w eq $ui_index} { + lappend cmd diff-index + lappend cmd --cached + } elseif {$w eq $ui_workdir} { + if {[string index $m 0] eq {U}} { + lappend cmd diff + } else { + lappend cmd diff-files + } + } + + lappend cmd -p + lappend cmd --no-color - if {$repo_config(gui.diffcontext) >= 0} { ++ if {$repo_config(gui.diffcontext) >= 1} { + lappend cmd "-U$repo_config(gui.diffcontext)" + } + if {$w eq $ui_index} { + lappend cmd [PARENT] + } + lappend cmd -- + lappend cmd $path + + if {[catch {set fd [eval git_read --nice $cmd]} err]} { + set diff_active 0 + unlock_index + ui_status [mc "Unable to display %s" [escape_path $path]] + error_popup [strcat [mc "Error loading diff:"] "\n\n$err"] + return + } + ++ set ::current_diff_inheader 1 + fconfigure $fd \ + -blocking 0 \ + -encoding binary \ + -translation binary + fileevent $fd readable [list read_diff $fd $scroll_pos] +} + +proc read_diff {fd scroll_pos} { + global ui_diff diff_active + global is_3way_diff current_diff_header + + $ui_diff conf -state normal + while {[gets $fd line] >= 0} { + # -- Cleanup uninteresting diff header lines. + # - if { [string match {diff --git *} $line] - || [string match {diff --cc *} $line] - || [string match {diff --combined *} $line] - || [string match {--- *} $line] - || [string match {+++ *} $line]} { - append current_diff_header $line "\n" - continue ++ if {$::current_diff_inheader} { ++ if { [string match {diff --git *} $line] ++ || [string match {diff --cc *} $line] ++ || [string match {diff --combined *} $line] ++ || [string match {--- *} $line] ++ || [string match {+++ *} $line]} { ++ append current_diff_header $line "\n" ++ continue ++ } + } + if {[string match {index *} $line]} continue + if {$line eq {deleted file mode 120000}} { + set line "deleted symlink" + } ++ set ::current_diff_inheader 0 + + # -- Automatically detect if this is a 3 way diff. + # + if {[string match {@@@ *} $line]} {set is_3way_diff 1} + + if {[string match {mode *} $line] + || [string match {new file *} $line] + || [regexp {^(old|new) mode *} $line] + || [string match {deleted file *} $line] + || [string match {deleted symlink} $line] + || [string match {Binary files * and * differ} $line] + || $line eq {\ No newline at end of file} + || [regexp {^\* Unmerged path } $line]} { + set tags {} + } elseif {$is_3way_diff} { + set op [string range $line 0 1] + switch -- $op { + { } {set tags {}} + {@@} {set tags d_@} + { +} {set tags d_s+} + { -} {set tags d_s-} + {+ } {set tags d_+s} + {- } {set tags d_-s} + {--} {set tags d_--} + {++} { + if {[regexp {^\+\+([<>]{7} |={7})} $line _g op]} { + set line [string replace $line 0 1 { }] + set tags d$op + } else { + set tags d_++ + } + } + default { + puts "error: Unhandled 3 way diff marker: {$op}" + set tags {} + } + } + } else { + set op [string index $line 0] + switch -- $op { + { } {set tags {}} + {@} {set tags d_@} + {-} {set tags d_-} + {+} { + if {[regexp {^\+([<>]{7} |={7})} $line _g op]} { + set line [string replace $line 0 0 { }] + set tags d$op + } else { + set tags d_+ + } + } + default { + puts "error: Unhandled 2 way diff marker: {$op}" + set tags {} + } + } + } + $ui_diff insert end $line $tags + if {[string index $line end] eq "\r"} { + $ui_diff tag add d_cr {end - 2c} + } + $ui_diff insert end "\n" $tags + } + $ui_diff conf -state disabled + + if {[eof $fd]} { + close $fd + set diff_active 0 + unlock_index + if {$scroll_pos ne {}} { + update + $ui_diff yview moveto $scroll_pos + } + ui_ready + + if {[$ui_diff index end] eq {2.0}} { + handle_empty_diff + } + } +} + +proc apply_hunk {x y} { + global current_diff_path current_diff_header current_diff_side + global ui_diff ui_index file_states + + if {$current_diff_path eq {} || $current_diff_header eq {}} return + if {![lock_index apply_hunk]} return + + set apply_cmd {apply --cached --whitespace=nowarn} + set mi [lindex $file_states($current_diff_path) 0] + if {$current_diff_side eq $ui_index} { + set failed_msg [mc "Failed to unstage selected hunk."] + lappend apply_cmd --reverse + if {[string index $mi 0] ne {M}} { + unlock_index + return + } + } else { + set failed_msg [mc "Failed to stage selected hunk."] + if {[string index $mi 1] ne {M}} { + unlock_index + return + } + } + + set s_lno [lindex [split [$ui_diff index @$x,$y] .] 0] + set s_lno [$ui_diff search -backwards -regexp ^@@ $s_lno.0 0.0] + if {$s_lno eq {}} { + unlock_index + return + } + + set e_lno [$ui_diff search -forwards -regexp ^@@ "$s_lno + 1 lines" end] + if {$e_lno eq {}} { + set e_lno end + } + + if {[catch { + set p [eval git_write $apply_cmd] + fconfigure $p -translation binary -encoding binary + 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"] + unlock_index + return + } + + $ui_diff conf -state normal + $ui_diff delete $s_lno $e_lno + $ui_diff conf -state disabled + + if {[$ui_diff get 1.0 end] eq "\n"} { + set o _ + } else { + set o ? + } + + if {$current_diff_side eq $ui_index} { + set mi ${o}M + } elseif {[string index $mi 0] eq {_}} { + set mi M$o + } else { + set mi ?$o + } + unlock_index + display_file $current_diff_path $mi + if {$o eq {_}} { + clear_diff + } else { + set current_diff_path $current_diff_path + } +} + +proc apply_line {x y} { + global current_diff_path current_diff_header current_diff_side + global ui_diff ui_index file_states + + if {$current_diff_path eq {} || $current_diff_header eq {}} return + if {![lock_index apply_hunk]} return + + set apply_cmd {apply --cached --whitespace=nowarn} + set mi [lindex $file_states($current_diff_path) 0] + if {$current_diff_side eq $ui_index} { + set failed_msg [mc "Failed to unstage selected line."] + set to_context {+} + lappend apply_cmd --reverse + if {[string index $mi 0] ne {M}} { + unlock_index + return + } + } else { + set failed_msg [mc "Failed to stage selected line."] + set to_context {-} + if {[string index $mi 1] ne {M}} { + unlock_index + return + } + } + + set the_l [$ui_diff index @$x,$y] + + # operate only on change lines + set c1 [$ui_diff get "$the_l linestart"] + if {$c1 ne {+} && $c1 ne {-}} { + unlock_index + return + } + set sign $c1 + + set i_l [$ui_diff search -backwards -regexp ^@@ $the_l 0.0] + if {$i_l eq {}} { + unlock_index + return + } + # $i_l is now at the beginning of a line + + # pick start line number from hunk header + set hh [$ui_diff get $i_l "$i_l + 1 lines"] + set hh [lindex [split $hh ,] 0] + set hln [lindex [split $hh -] 1] + + # There is a special situation to take care of. Consider this hunk: + # + # @@ -10,4 +10,4 @@ + # context before + # -old 1 + # -old 2 + # +new 1 + # +new 2 + # context after + # + # We used to keep the context lines in the order they appear in the + # hunk. But then it is not possible to correctly stage only + # "-old 1" and "+new 1" - it would result in this staged text: + # + # context before + # old 2 + # new 1 + # context after + # + # (By symmetry it is not possible to *un*stage "old 2" and "new 2".) + # + # We resolve the problem by introducing an asymmetry, namely, when + # a "+" line is *staged*, it is moved in front of the context lines + # that are generated from the "-" lines that are immediately before + # the "+" block. That is, we construct this patch: + # + # @@ -10,4 +10,5 @@ + # context before + # +new 1 + # old 1 + # old 2 + # context after + # + # But we do *not* treat "-" lines that are *un*staged in a special + # way. + # + # With this asymmetry it is possible to stage the change + # "old 1" -> "new 1" directly, and to stage the change + # "old 2" -> "new 2" by first staging the entire hunk and + # then unstaging the change "old 1" -> "new 1". + + # This is non-empty if and only if we are _staging_ changes; + # then it accumulates the consecutive "-" lines (after converting + # them to context lines) in order to be moved after the "+" change + # line. + set pre_context {} + + set n 0 + set i_l [$ui_diff index "$i_l + 1 lines"] + set patch {} + while {[$ui_diff compare $i_l < "end - 1 chars"] && + [$ui_diff get $i_l "$i_l + 2 chars"] ne {@@}} { + set next_l [$ui_diff index "$i_l + 1 lines"] + set c1 [$ui_diff get $i_l] + if {[$ui_diff compare $i_l <= $the_l] && + [$ui_diff compare $the_l < $next_l]} { + # the line to stage/unstage + set ln [$ui_diff get $i_l $next_l] + if {$c1 eq {-}} { + set n [expr $n+1] + set patch "$patch$pre_context$ln" + } else { + set patch "$patch$ln$pre_context" + } + set pre_context {} + } elseif {$c1 ne {-} && $c1 ne {+}} { + # context line + set ln [$ui_diff get $i_l $next_l] + set patch "$patch$pre_context$ln" + set n [expr $n+1] + set pre_context {} + } elseif {$c1 eq $to_context} { + # turn change line into context line + set ln [$ui_diff get "$i_l + 1 chars" $next_l] + if {$c1 eq {-}} { + set pre_context "$pre_context $ln" + } else { + set patch "$patch $ln" + } + set n [expr $n+1] + } + set i_l $next_l + } + set patch "@@ -$hln,$n +$hln,[eval expr $n $sign 1] @@\n$patch" + + if {[catch { + set p [eval git_write $apply_cmd] + fconfigure $p -translation binary -encoding binary + puts -nonewline $p $current_diff_header + puts -nonewline $p $patch + close $p} err]} { + error_popup [append $failed_msg "\n\n$err"] + } + + unlock_index +} diff --cc git-gui/lib/option.tcl index ffb3f00ff,000000000..5e1346e60 mode 100644,000000..100644 --- a/git-gui/lib/option.tcl +++ b/git-gui/lib/option.tcl @@@ -1,281 -1,0 +1,281 @@@ +# git-gui options editor +# Copyright (C) 2006, 2007 Shawn Pearce + +proc save_config {} { + global default_config font_descs + global repo_config global_config + global repo_config_new global_config_new + global ui_comm_spell + + foreach option $font_descs { + set name [lindex $option 0] + set font [lindex $option 1] + font configure $font \ + -family $global_config_new(gui.$font^^family) \ + -size $global_config_new(gui.$font^^size) + font configure ${font}bold \ + -family $global_config_new(gui.$font^^family) \ + -size $global_config_new(gui.$font^^size) + font configure ${font}italic \ + -family $global_config_new(gui.$font^^family) \ + -size $global_config_new(gui.$font^^size) + set global_config_new(gui.$name) [font configure $font] + unset global_config_new(gui.$font^^family) + unset global_config_new(gui.$font^^size) + } + + foreach name [array names default_config] { + set value $global_config_new($name) + if {$value ne $global_config($name)} { + if {$value eq $default_config($name)} { + catch {git config --global --unset $name} + } else { + regsub -all "\[{}\]" $value {"} value + git config --global $name $value + } + set global_config($name) $value + if {$value eq $repo_config($name)} { + catch {git config --unset $name} + set repo_config($name) $value + } + } + } + + foreach name [array names default_config] { + set value $repo_config_new($name) + if {$value ne $repo_config($name)} { + if {$value eq $global_config($name)} { + catch {git config --unset $name} + } else { + regsub -all "\[{}\]" $value {"} value + git config $name $value + } + set repo_config($name) $value + } + } + + if {[info exists repo_config(gui.spellingdictionary)]} { + set value $repo_config(gui.spellingdictionary) + if {$value eq {none}} { + if {[info exists ui_comm_spell]} { + $ui_comm_spell stop + } + } elseif {[info exists ui_comm_spell]} { + $ui_comm_spell lang $value + } + } +} + +proc do_options {} { + global repo_config global_config font_descs + global repo_config_new global_config_new + global ui_comm_spell + + array unset repo_config_new + array unset global_config_new + foreach name [array names repo_config] { + set repo_config_new($name) $repo_config($name) + } + load_config 1 + foreach name [array names repo_config] { + switch -- $name { + gui.diffcontext {continue} + } + set repo_config_new($name) $repo_config($name) + } + foreach name [array names global_config] { + set global_config_new($name) $global_config($name) + } + + set w .options_editor + toplevel $w + wm geometry $w "+[winfo rootx .]+[winfo rooty .]" + + frame $w.buttons + button $w.buttons.restore -text [mc "Restore Defaults"] \ + -default normal \ + -command do_restore_defaults + pack $w.buttons.restore -side left + button $w.buttons.save -text [mc Save] \ + -default active \ + -command [list do_save_config $w] + pack $w.buttons.save -side right + button $w.buttons.cancel -text [mc "Cancel"] \ + -default normal \ + -command [list destroy $w] + pack $w.buttons.cancel -side right -padx 5 + pack $w.buttons -side bottom -fill x -pady 10 -padx 10 + + labelframe $w.repo -text [mc "%s Repository" [reponame]] + labelframe $w.global -text [mc "Global (All Repositories)"] + pack $w.repo -side left -fill both -expand 1 -pady 5 -padx 5 + pack $w.global -side right -fill both -expand 1 -pady 5 -padx 5 + + set optid 0 + foreach option { + {t user.name {mc "User Name"}} + {t user.email {mc "Email Address"}} + + {b merge.summary {mc "Summarize Merge Commits"}} + {i-1..5 merge.verbosity {mc "Merge Verbosity"}} + {b merge.diffstat {mc "Show Diffstat After Merge"}} + + {b gui.trustmtime {mc "Trust File Modification Timestamps"}} + {b gui.pruneduringfetch {mc "Prune Tracking Branches During Fetch"}} + {b gui.matchtrackingbranch {mc "Match Tracking Branches"}} + {b gui.fastcopyblame {mc "Blame Copy Only On Changed Files"}} + {i-20..200 gui.copyblamethreshold {mc "Minimum Letters To Blame Copy On"}} - {i-0..99 gui.diffcontext {mc "Number of Diff Context Lines"}} ++ {i-1..99 gui.diffcontext {mc "Number of Diff Context Lines"}} + {i-0..99 gui.commitmsgwidth {mc "Commit Message Text Width"}} + {t gui.newbranchtemplate {mc "New Branch Name Template"}} + } { + set type [lindex $option 0] + set name [lindex $option 1] + set text [eval [lindex $option 2]] + incr optid + foreach f {repo global} { + switch -glob -- $type { + b { + checkbutton $w.$f.$optid -text $text \ + -variable ${f}_config_new($name) \ + -onvalue true \ + -offvalue false + pack $w.$f.$optid -side top -anchor w + } + i-* { + regexp -- {-(\d+)\.\.(\d+)$} $type _junk min max + frame $w.$f.$optid + label $w.$f.$optid.l -text "$text:" + pack $w.$f.$optid.l -side left -anchor w -fill x + spinbox $w.$f.$optid.v \ + -textvariable ${f}_config_new($name) \ + -from $min \ + -to $max \ + -increment 1 \ + -width [expr {1 + [string length $max]}] + bind $w.$f.$optid.v {%W selection range 0 end} + pack $w.$f.$optid.v -side right -anchor e -padx 5 + pack $w.$f.$optid -side top -anchor w -fill x + } + t { + frame $w.$f.$optid + label $w.$f.$optid.l -text "$text:" + entry $w.$f.$optid.v \ + -borderwidth 1 \ + -relief sunken \ + -width 20 \ + -textvariable ${f}_config_new($name) + pack $w.$f.$optid.l -side left -anchor w + pack $w.$f.$optid.v -side left -anchor w \ + -fill x -expand 1 \ + -padx 5 + pack $w.$f.$optid -side top -anchor w -fill x + } + } + } + } + + set all_dicts [linsert \ + [spellcheck::available_langs] \ + 0 \ + none] + incr optid + foreach f {repo global} { + if {![info exists ${f}_config_new(gui.spellingdictionary)]} { + if {[info exists ui_comm_spell]} { + set value [$ui_comm_spell lang] + } else { + set value none + } + set ${f}_config_new(gui.spellingdictionary) $value + } + + frame $w.$f.$optid + label $w.$f.$optid.l -text [mc "Spelling Dictionary:"] + eval tk_optionMenu $w.$f.$optid.v \ + ${f}_config_new(gui.spellingdictionary) \ + $all_dicts + pack $w.$f.$optid.l -side left -anchor w -fill x + pack $w.$f.$optid.v -side right -anchor e -padx 5 + pack $w.$f.$optid -side top -anchor w -fill x + } + unset all_dicts + + set all_fonts [lsort [font families]] + foreach option $font_descs { + set name [lindex $option 0] + set font [lindex $option 1] + set text [eval [lindex $option 2]] + + set global_config_new(gui.$font^^family) \ + [font configure $font -family] + set global_config_new(gui.$font^^size) \ + [font configure $font -size] + + frame $w.global.$name + label $w.global.$name.l -text "$text:" + button $w.global.$name.b \ + -text [mc "Change Font"] \ + -command [list \ + choose_font::pick \ + $w \ + [mc "Choose %s" $text] \ + global_config_new(gui.$font^^family) \ + global_config_new(gui.$font^^size) \ + ] + label $w.global.$name.f -textvariable global_config_new(gui.$font^^family) + label $w.global.$name.s -textvariable global_config_new(gui.$font^^size) + label $w.global.$name.pt -text [mc "pt."] + pack $w.global.$name.l -side left -anchor w + pack $w.global.$name.b -side right -anchor e + pack $w.global.$name.pt -side right -anchor w + pack $w.global.$name.s -side right -anchor w + pack $w.global.$name.f -side right -anchor w + pack $w.global.$name -side top -anchor w -fill x + } + + bind $w "grab $w; focus $w.buttons.save" + bind $w "destroy $w" + bind $w [list do_save_config $w] + + if {[is_MacOSX]} { + set t [mc "Preferences"] + } else { + set t [mc "Options"] + } + wm title $w "[appname] ([reponame]): $t" + tkwait window $w +} + +proc do_restore_defaults {} { + global font_descs default_config repo_config + global repo_config_new global_config_new + + foreach name [array names default_config] { + set repo_config_new($name) $default_config($name) + set global_config_new($name) $default_config($name) + } + + foreach option $font_descs { + set name [lindex $option 0] + set repo_config(gui.$name) $default_config(gui.$name) + } + apply_config + + foreach option $font_descs { + set name [lindex $option 0] + set font [lindex $option 1] + set global_config_new(gui.$font^^family) \ + [font configure $font -family] + set global_config_new(gui.$font^^size) \ + [font configure $font -size] + } +} + +proc do_save_config {w} { + if {[catch {save_config} err]} { + error_popup [strcat [mc "Failed to completely save options:"] "\n\n$err"] + } + reshow_diff + destroy $w +} diff --cc git-gui/po/fr.po index 89b6d51ea,000000000..26b866f55 mode 100644,000000..100644 --- a/git-gui/po/fr.po +++ b/git-gui/po/fr.po @@@ -1,1992 -1,0 +1,2038 @@@ - # translation of fr.po to French ++# translation of fr.po to Français +# Translation of git-gui to French. +# Copyright (C) 2008 Shawn Pearce, et al. +# This file is distributed under the same license as the git package. +# +# Christian Couder , 2008. ++# Alexandre Bourget , 2008. +msgid "" +msgstr "" +"Project-Id-Version: fr\n" +"Report-Msgid-Bugs-To: \n" - "POT-Creation-Date: 2008-03-14 07:18+0100\n" - "PO-Revision-Date: 2008-04-04 22:05+0200\n" - "Last-Translator: Christian Couder \n" - "Language-Team: French\n" ++"POT-Creation-Date: 2008-08-02 14:45-0700\n" ++"PO-Revision-Date: 2008-08-11 17:12-0400\n" ++"Last-Translator: Alexandre Bourget \n" ++"Language-Team: Français \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: KBabel 1.11.4\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + - #: git-gui.sh:41 git-gui.sh:634 git-gui.sh:648 git-gui.sh:661 git-gui.sh:744 - #: git-gui.sh:763 ++#: git-gui.sh:41 git-gui.sh:688 git-gui.sh:702 git-gui.sh:715 git-gui.sh:798 ++#: git-gui.sh:817 +msgid "git-gui: fatal error" +msgstr "git-gui: erreur fatale" + - #: git-gui.sh:593 ++#: git-gui.sh:644 +#, tcl-format +msgid "Invalid font specified in %s:" - msgstr "Invalide fonte spécifiée dans %s :" ++msgstr "Police invalide spécifiée dans %s :" + - #: git-gui.sh:620 ++#: git-gui.sh:674 +msgid "Main Font" - msgstr "Fonte principale" ++msgstr "Police principale" + - #: git-gui.sh:621 ++#: git-gui.sh:675 +msgid "Diff/Console Font" - msgstr "Fonte diff/console" ++msgstr "Police diff/console" + - #: git-gui.sh:635 ++#: git-gui.sh:689 +msgid "Cannot find git in PATH." +msgstr "Impossible de trouver git dans PATH." + - #: git-gui.sh:662 ++#: git-gui.sh:716 +msgid "Cannot parse Git version string:" +msgstr "Impossible de parser la version de Git :" + - #: git-gui.sh:680 ++#: git-gui.sh:734 +#, tcl-format +msgid "" +"Git version cannot be determined.\n" +"\n" +"%s claims it is version '%s'.\n" +"\n" +"%s requires at least Git 1.5.0 or later.\n" +"\n" +"Assume '%s' is version 1.5.0?\n" +msgstr "" +"Impossible de déterminer la version de Git.\n" +"\n" +"%s affirme qu'il s'agit de la version '%s'.\n" +"\n" +"%s nécessite au moins Git 1.5.0.\n" +"\n" +"Peut'on considérer que '%s' est en version 1.5.0 ?\n" + - #: git-gui.sh:918 ++#: git-gui.sh:972 +msgid "Git directory not found:" - msgstr "Impossible de trouver le répertoire de Git :" ++msgstr "Impossible de trouver le répertoire git :" + - #: git-gui.sh:925 ++#: git-gui.sh:979 +msgid "Cannot move to top of working directory:" +msgstr "Impossible d'aller à la racine du répertoire de travail :" + - #: git-gui.sh:932 ++#: git-gui.sh:986 +msgid "Cannot use funny .git directory:" - msgstr "Impossible d'utiliser un drôle de répertoire git :" ++msgstr "Impossible d'utiliser le répertoire .git:" + - #: git-gui.sh:937 ++#: git-gui.sh:991 +msgid "No working directory" - msgstr "Pas de répertoire de travail" ++msgstr "Aucun répertoire de travail" + - #: git-gui.sh:1084 lib/checkout_op.tcl:283 ++#: git-gui.sh:1138 lib/checkout_op.tcl:305 +msgid "Refreshing file status..." +msgstr "Rafraichissement du status des fichiers..." + - #: git-gui.sh:1149 ++#: git-gui.sh:1194 +msgid "Scanning for modified files ..." +msgstr "Recherche de fichiers modifiés..." + - #: git-gui.sh:1324 lib/browser.tcl:246 ++#: git-gui.sh:1369 lib/browser.tcl:246 +msgid "Ready." +msgstr "Prêt." + - #: git-gui.sh:1590 ++#: git-gui.sh:1635 +msgid "Unmodified" +msgstr "Non modifié" + - #: git-gui.sh:1592 ++#: git-gui.sh:1637 +msgid "Modified, not staged" - msgstr "Modifié, non pré-commité" ++msgstr "Modifié, pas indexé" + - #: git-gui.sh:1593 git-gui.sh:1598 ++#: git-gui.sh:1638 git-gui.sh:1643 +msgid "Staged for commit" - msgstr "Pré-commité" ++msgstr "Indexé" + - #: git-gui.sh:1594 git-gui.sh:1599 ++#: git-gui.sh:1639 git-gui.sh:1644 +msgid "Portions staged for commit" - msgstr "En partie pré-commité" ++msgstr "Portions indexées" + - #: git-gui.sh:1595 git-gui.sh:1600 ++#: git-gui.sh:1640 git-gui.sh:1645 +msgid "Staged for commit, missing" - msgstr "Pré-commité, manquant" ++msgstr "Indexés, manquant" + - #: git-gui.sh:1597 ++#: git-gui.sh:1642 +msgid "Untracked, not staged" - msgstr "Non suivi, non pré-commité" ++msgstr "Non versionné, non indexé" + - #: git-gui.sh:1602 ++#: git-gui.sh:1647 +msgid "Missing" +msgstr "Manquant" + - #: git-gui.sh:1603 ++#: git-gui.sh:1648 +msgid "Staged for removal" - msgstr "Pré-commité pour suppression" ++msgstr "Indexé pour suppression" + - #: git-gui.sh:1604 ++#: git-gui.sh:1649 +msgid "Staged for removal, still present" - msgstr "Pré-commité pour suppression, toujours présent" ++msgstr "Indexé pour suppression, toujours présent" + - #: git-gui.sh:1606 git-gui.sh:1607 git-gui.sh:1608 git-gui.sh:1609 ++#: git-gui.sh:1651 git-gui.sh:1652 git-gui.sh:1653 git-gui.sh:1654 +msgid "Requires merge resolution" +msgstr "Nécessite la résolution d'une fusion" + - #: git-gui.sh:1644 ++#: git-gui.sh:1689 +msgid "Starting gitk... please wait..." - msgstr "Lancement de gitk... merci de patienter..." ++msgstr "Lancement de gitk... un instant..." + - #: git-gui.sh:1653 - #, tcl-format - msgid "" - "Unable to start gitk:\n" - "\n" - "%s does not exist" - msgstr "" - "Impossible de lancer gitk :\n" - "\n" - "%s inexistant" ++#: git-gui.sh:1698 ++msgid "Couldn't find gitk in PATH" ++msgstr "Impossible de trouver gitk dans PATH." + - #: git-gui.sh:1860 lib/choose_repository.tcl:36 ++#: git-gui.sh:1948 lib/choose_repository.tcl:36 +msgid "Repository" - msgstr "Référentiel" ++msgstr "Dépôt" + - #: git-gui.sh:1861 ++#: git-gui.sh:1949 +msgid "Edit" - msgstr "Editer" ++msgstr "Edition" + - #: git-gui.sh:1863 lib/choose_rev.tcl:561 ++#: git-gui.sh:1951 lib/choose_rev.tcl:561 +msgid "Branch" +msgstr "Branche" + - #: git-gui.sh:1866 lib/choose_rev.tcl:548 ++#: git-gui.sh:1954 lib/choose_rev.tcl:548 +msgid "Commit@@noun" +msgstr "Commit" + - #: git-gui.sh:1869 lib/merge.tcl:120 lib/merge.tcl:149 lib/merge.tcl:167 ++#: git-gui.sh:1957 lib/merge.tcl:120 lib/merge.tcl:149 lib/merge.tcl:167 +msgid "Merge" +msgstr "Fusionner" + - #: git-gui.sh:1870 lib/choose_rev.tcl:557 ++#: git-gui.sh:1958 lib/choose_rev.tcl:557 +msgid "Remote" - msgstr "Référentiel distant" ++msgstr "Dépôt distant" + - #: git-gui.sh:1879 ++#: git-gui.sh:1967 +msgid "Browse Current Branch's Files" - msgstr "Visionner fichiers dans branche courante" ++msgstr "Naviguer dans la branche courante" + - #: git-gui.sh:1883 ++#: git-gui.sh:1971 +msgid "Browse Branch Files..." - msgstr "Visionner fichiers de branche" ++msgstr "Naviguer dans la branche..." + - #: git-gui.sh:1888 ++#: git-gui.sh:1976 +msgid "Visualize Current Branch's History" +msgstr "Visualiser historique branche courante" + - #: git-gui.sh:1892 ++#: git-gui.sh:1980 +msgid "Visualize All Branch History" - msgstr "Visualiser historique toutes branches" ++msgstr "Voir l'historique de toutes les branches" + - #: git-gui.sh:1899 ++#: git-gui.sh:1987 +#, tcl-format +msgid "Browse %s's Files" - msgstr "Visionner fichiers de %s" ++msgstr "Naviguer l'arborescence de %s" + - #: git-gui.sh:1901 ++#: git-gui.sh:1989 +#, tcl-format +msgid "Visualize %s's History" - msgstr "Visualiser historique de %s" ++msgstr "Voir l'historique de la branche: %s" + - #: git-gui.sh:1906 lib/database.tcl:27 lib/database.tcl:67 ++#: git-gui.sh:1994 lib/database.tcl:27 lib/database.tcl:67 +msgid "Database Statistics" - msgstr "Statistiques base de donnée" ++msgstr "Statistiques du dépôt" + - #: git-gui.sh:1909 lib/database.tcl:34 ++#: git-gui.sh:1997 lib/database.tcl:34 +msgid "Compress Database" - msgstr "Comprimer base de donnée" ++msgstr "Comprimer le dépôt" + - #: git-gui.sh:1912 ++#: git-gui.sh:2000 +msgid "Verify Database" - msgstr "Vérifier base de donnée" ++msgstr "Vérifier le dépôt" + - #: git-gui.sh:1919 git-gui.sh:1923 git-gui.sh:1927 lib/shortcut.tcl:7 ++#: git-gui.sh:2007 git-gui.sh:2011 git-gui.sh:2015 lib/shortcut.tcl:7 +#: lib/shortcut.tcl:39 lib/shortcut.tcl:71 +msgid "Create Desktop Icon" +msgstr "Créer icône sur bureau" + - #: git-gui.sh:1932 lib/choose_repository.tcl:177 lib/choose_repository.tcl:185 ++#: git-gui.sh:2023 lib/choose_repository.tcl:177 lib/choose_repository.tcl:185 +msgid "Quit" +msgstr "Quitter" + - #: git-gui.sh:1939 ++#: git-gui.sh:2031 +msgid "Undo" +msgstr "Défaire" + - #: git-gui.sh:1942 ++#: git-gui.sh:2034 +msgid "Redo" +msgstr "Refaire" + - #: git-gui.sh:1946 git-gui.sh:2443 ++#: git-gui.sh:2038 git-gui.sh:2545 +msgid "Cut" +msgstr "Couper" + - #: git-gui.sh:1949 git-gui.sh:2446 git-gui.sh:2520 git-gui.sh:2614 ++#: git-gui.sh:2041 git-gui.sh:2548 git-gui.sh:2622 git-gui.sh:2715 +#: lib/console.tcl:69 +msgid "Copy" +msgstr "Copier" + - #: git-gui.sh:1952 git-gui.sh:2449 ++#: git-gui.sh:2044 git-gui.sh:2551 +msgid "Paste" +msgstr "Coller" + - #: git-gui.sh:1955 git-gui.sh:2452 lib/branch_delete.tcl:26 ++#: git-gui.sh:2047 git-gui.sh:2554 lib/branch_delete.tcl:26 +#: lib/remote_branch_delete.tcl:38 +msgid "Delete" +msgstr "Supprimer" + - #: git-gui.sh:1959 git-gui.sh:2456 git-gui.sh:2618 lib/console.tcl:71 ++#: git-gui.sh:2051 git-gui.sh:2558 git-gui.sh:2719 lib/console.tcl:71 +msgid "Select All" +msgstr "Tout sélectionner" + - #: git-gui.sh:1968 ++#: git-gui.sh:2060 +msgid "Create..." +msgstr "Créer..." + - #: git-gui.sh:1974 ++#: git-gui.sh:2066 +msgid "Checkout..." - msgstr "Emprunter... " ++msgstr "Charger (checkout)..." + - #: git-gui.sh:1980 ++#: git-gui.sh:2072 +msgid "Rename..." +msgstr "Renommer..." + - #: git-gui.sh:1985 git-gui.sh:2085 ++#: git-gui.sh:2077 git-gui.sh:2187 +msgid "Delete..." +msgstr "Supprimer..." + - #: git-gui.sh:1990 ++#: git-gui.sh:2082 +msgid "Reset..." +msgstr "Réinitialiser..." + - #: git-gui.sh:2002 git-gui.sh:2389 ++#: git-gui.sh:2094 git-gui.sh:2491 +msgid "New Commit" +msgstr "Nouveau commit" + - #: git-gui.sh:2010 git-gui.sh:2396 ++#: git-gui.sh:2102 git-gui.sh:2498 +msgid "Amend Last Commit" +msgstr "Corriger dernier commit" + - #: git-gui.sh:2019 git-gui.sh:2356 lib/remote_branch_delete.tcl:99 ++#: git-gui.sh:2111 git-gui.sh:2458 lib/remote_branch_delete.tcl:99 +msgid "Rescan" - msgstr "Resynchroniser" ++msgstr "Recharger modifs." + - #: git-gui.sh:2025 ++#: git-gui.sh:2117 +msgid "Stage To Commit" - msgstr "Commiter un pré-commit" ++msgstr "Indexer" + - #: git-gui.sh:2031 ++#: git-gui.sh:2123 +msgid "Stage Changed Files To Commit" - msgstr "Commiter fichiers modifiés dans pré-commit" ++msgstr "Indexer toutes modifications" + - #: git-gui.sh:2037 ++#: git-gui.sh:2129 +msgid "Unstage From Commit" - msgstr "Commit vers pré-commit" ++msgstr "Désindexer" + - #: git-gui.sh:2042 lib/index.tcl:395 ++#: git-gui.sh:2134 lib/index.tcl:395 +msgid "Revert Changes" - msgstr "Inverser modification" ++msgstr "Annuler les modifications (revert)" + - #: git-gui.sh:2049 git-gui.sh:2368 git-gui.sh:2467 ++#: git-gui.sh:2141 git-gui.sh:2702 ++msgid "Show Less Context" ++msgstr "Montrer moins de contexte" ++ ++#: git-gui.sh:2145 git-gui.sh:2706 ++msgid "Show More Context" ++msgstr "Montrer plus de contexte" ++ ++#: git-gui.sh:2151 git-gui.sh:2470 git-gui.sh:2569 +msgid "Sign Off" - msgstr "Se désinscrire" ++msgstr "Signer" + - #: git-gui.sh:2053 git-gui.sh:2372 ++#: git-gui.sh:2155 git-gui.sh:2474 +msgid "Commit@@verb" +msgstr "Commiter" + - #: git-gui.sh:2064 ++#: git-gui.sh:2166 +msgid "Local Merge..." +msgstr "Fusion locale..." + - #: git-gui.sh:2069 ++#: git-gui.sh:2171 +msgid "Abort Merge..." +msgstr "Abandonner fusion..." + - #: git-gui.sh:2081 ++#: git-gui.sh:2183 +msgid "Push..." +msgstr "Pousser..." + - #: git-gui.sh:2092 lib/choose_repository.tcl:41 - msgid "Apple" - msgstr "Pomme" - - #: git-gui.sh:2095 git-gui.sh:2117 lib/about.tcl:14 ++#: git-gui.sh:2197 git-gui.sh:2219 lib/about.tcl:14 +#: lib/choose_repository.tcl:44 lib/choose_repository.tcl:50 +#, tcl-format +msgid "About %s" - msgstr "A propos de %s" ++msgstr "À propos de %s" + - #: git-gui.sh:2099 ++#: git-gui.sh:2201 +msgid "Preferences..." +msgstr "Préférences..." + - #: git-gui.sh:2107 git-gui.sh:2639 ++#: git-gui.sh:2209 git-gui.sh:2740 +msgid "Options..." +msgstr "Options..." + - #: git-gui.sh:2113 lib/choose_repository.tcl:47 ++#: git-gui.sh:2215 lib/choose_repository.tcl:47 +msgid "Help" +msgstr "Aide" + - #: git-gui.sh:2154 ++#: git-gui.sh:2256 +msgid "Online Documentation" +msgstr "Documentation en ligne" + - #: git-gui.sh:2238 ++#: git-gui.sh:2340 +#, tcl-format +msgid "fatal: cannot stat path %s: No such file or directory" - msgstr "erreur fatale : pas d'infos sur le chemin %s : Fichier ou répertoire inexistant" ++msgstr "" ++"erreur fatale : pas d'infos sur le chemin %s : Fichier ou répertoire " ++"inexistant" + - #: git-gui.sh:2271 ++#: git-gui.sh:2373 +msgid "Current Branch:" +msgstr "Branche courante :" + - #: git-gui.sh:2292 ++#: git-gui.sh:2394 +msgid "Staged Changes (Will Commit)" - msgstr "Modifications pré-commitées" ++msgstr "Modifs. indexées (pour commit)" + - #: git-gui.sh:2312 ++#: git-gui.sh:2414 +msgid "Unstaged Changes" - msgstr "Modifications non pré-commitées" ++msgstr "Modifs. non indexées" + - #: git-gui.sh:2362 ++#: git-gui.sh:2464 +msgid "Stage Changed" - msgstr "Pré-commit modifié" ++msgstr "Indexer modifs." + - #: git-gui.sh:2378 lib/transport.tcl:93 lib/transport.tcl:182 ++#: git-gui.sh:2480 lib/transport.tcl:93 lib/transport.tcl:182 +msgid "Push" +msgstr "Pousser" + - #: git-gui.sh:2408 ++#: git-gui.sh:2510 +msgid "Initial Commit Message:" +msgstr "Message de commit initial :" + - #: git-gui.sh:2409 ++#: git-gui.sh:2511 +msgid "Amended Commit Message:" +msgstr "Message de commit corrigé :" + - #: git-gui.sh:2410 ++#: git-gui.sh:2512 +msgid "Amended Initial Commit Message:" +msgstr "Message de commit initial corrigé :" + - #: git-gui.sh:2411 ++#: git-gui.sh:2513 +msgid "Amended Merge Commit Message:" +msgstr "Message de commit de fusion corrigé :" + - #: git-gui.sh:2412 ++#: git-gui.sh:2514 +msgid "Merge Commit Message:" +msgstr "Message de commit de fusion :" + - #: git-gui.sh:2413 ++#: git-gui.sh:2515 +msgid "Commit Message:" +msgstr "Message de commit :" + - #: git-gui.sh:2459 git-gui.sh:2622 lib/console.tcl:73 ++#: git-gui.sh:2561 git-gui.sh:2723 lib/console.tcl:73 +msgid "Copy All" +msgstr "Copier tout" + - #: git-gui.sh:2483 lib/blame.tcl:107 ++#: git-gui.sh:2585 lib/blame.tcl:100 +msgid "File:" +msgstr "Fichier :" + - #: git-gui.sh:2589 ++#: git-gui.sh:2691 +msgid "Apply/Reverse Hunk" +msgstr "Appliquer/Inverser section" + - #: git-gui.sh:2595 - msgid "Show Less Context" - msgstr "Montrer moins de contexte" - - #: git-gui.sh:2602 - msgid "Show More Context" - msgstr "Montrer plus de contexte" ++#: git-gui.sh:2696 ++msgid "Apply/Reverse Line" ++msgstr "Appliquer/Inverser la ligne" + - #: git-gui.sh:2610 ++#: git-gui.sh:2711 +msgid "Refresh" +msgstr "Rafraichir" + - #: git-gui.sh:2631 ++#: git-gui.sh:2732 +msgid "Decrease Font Size" - msgstr "Réduire fonte" ++msgstr "Diminuer la police" + - #: git-gui.sh:2635 ++#: git-gui.sh:2736 +msgid "Increase Font Size" - msgstr "Agrandir fonte" ++msgstr "Agrandir la police" + - #: git-gui.sh:2646 ++#: git-gui.sh:2747 +msgid "Unstage Hunk From Commit" - msgstr "Enlever section pré-commitée" ++msgstr "Désindexer la section" ++ ++#: git-gui.sh:2748 ++msgid "Unstage Line From Commit" ++msgstr "Désindexer la ligne" + - #: git-gui.sh:2648 ++#: git-gui.sh:2750 +msgid "Stage Hunk For Commit" - msgstr "Pré-commiter section" ++msgstr "Indexer la section" + - #: git-gui.sh:2667 ++#: git-gui.sh:2751 ++msgid "Stage Line For Commit" ++msgstr "Indexer la ligne" ++ ++#: git-gui.sh:2771 +msgid "Initializing..." +msgstr "Initialisation..." + - #: git-gui.sh:2762 ++#: git-gui.sh:2876 +#, tcl-format +msgid "" +"Possible environment issues exist.\n" +"\n" +"The following environment variables are probably\n" +"going to be ignored by any Git subprocess run\n" +"by %s:\n" +"\n" +msgstr "" +"Des problèmes d'environnement sont possibles.\n" +"\n" +"Les variables d'environnement suivantes seront\n" +"probablement ignorées par tous les\n" +"sous-processus de Git lancés par %s\n" +"\n" + - #: git-gui.sh:2792 ++#: git-gui.sh:2906 +msgid "" +"\n" +"This is due to a known issue with the\n" +"Tcl binary distributed by Cygwin." +msgstr "" +"\n" +"Ceci est du à un problème connu avec\n" +"le binaire Tcl distribué par Cygwin." + - #: git-gui.sh:2797 ++#: git-gui.sh:2911 +#, tcl-format +msgid "" +"\n" +"\n" +"A good replacement for %s\n" +"is placing values for the user.name and\n" +"user.email settings into your personal\n" +"~/.gitconfig file.\n" +msgstr "" +"\n" +"\n" +"Un bon remplacement pour %s\n" +"est de mettre les valeurs pour 'user.name' (nom\n" +"de l'utilisateur) et 'user.email' (addresse email\n" +"de l'utilisateur) dans votre fichier '~/.gitconfig'.\n" + +#: lib/about.tcl:26 +msgid "git-gui - a graphical user interface for Git." +msgstr "git-gui - une interface graphique utilisateur pour Git" + - #: lib/blame.tcl:77 ++#: lib/blame.tcl:70 +msgid "File Viewer" +msgstr "Visionneur de fichier" + - #: lib/blame.tcl:81 ++#: lib/blame.tcl:74 +msgid "Commit:" +msgstr "Commit :" + - #: lib/blame.tcl:264 ++#: lib/blame.tcl:257 +msgid "Copy Commit" +msgstr "Copier commit" + - #: lib/blame.tcl:384 ++#: lib/blame.tcl:260 ++msgid "Do Full Copy Detection" ++msgstr "Lancer la détection approfondie des copies" ++ ++#: lib/blame.tcl:388 +#, tcl-format +msgid "Reading %s..." +msgstr "Lecture de %s..." + - #: lib/blame.tcl:488 ++#: lib/blame.tcl:492 +msgid "Loading copy/move tracking annotations..." +msgstr "Chargement des annotations de suivi des copies/déplacements..." + - #: lib/blame.tcl:508 ++#: lib/blame.tcl:512 +msgid "lines annotated" +msgstr "lignes annotées" + - #: lib/blame.tcl:689 ++#: lib/blame.tcl:704 +msgid "Loading original location annotations..." +msgstr "Chargement des annotations d'emplacement original" + - #: lib/blame.tcl:692 ++#: lib/blame.tcl:707 +msgid "Annotation complete." +msgstr "Annotation terminée." + - #: lib/blame.tcl:746 ++#: lib/blame.tcl:737 ++msgid "Busy" ++msgstr "Occupé" ++ ++#: lib/blame.tcl:738 ++msgid "Annotation process is already running." ++msgstr "Annotation en cours d'exécution." ++ ++#: lib/blame.tcl:777 ++msgid "Running thorough copy detection..." ++msgstr "Recherche de copie approfondie en cours..." ++ ++#: lib/blame.tcl:827 +msgid "Loading annotation..." +msgstr "Chargement des annotations..." + - #: lib/blame.tcl:802 ++#: lib/blame.tcl:883 +msgid "Author:" +msgstr "Auteur :" + - #: lib/blame.tcl:806 ++#: lib/blame.tcl:887 +msgid "Committer:" +msgstr "Commiteur :" + - #: lib/blame.tcl:811 ++#: lib/blame.tcl:892 +msgid "Original File:" +msgstr "Fichier original :" + - #: lib/blame.tcl:925 ++#: lib/blame.tcl:1006 +msgid "Originally By:" +msgstr "A l'origine par :" + - #: lib/blame.tcl:931 ++#: lib/blame.tcl:1012 +msgid "In File:" +msgstr "Dans le fichier :" + - #: lib/blame.tcl:936 ++#: lib/blame.tcl:1017 +msgid "Copied Or Moved Here By:" +msgstr "Copié ou déplacé ici par :" + +#: lib/branch_checkout.tcl:14 lib/branch_checkout.tcl:19 +msgid "Checkout Branch" - msgstr "Emprunter branche" ++msgstr "Charger la branche (checkout)" + +#: lib/branch_checkout.tcl:23 +msgid "Checkout" - msgstr "Emprunter" ++msgstr "Charger (checkout)" + +#: lib/branch_checkout.tcl:27 lib/branch_create.tcl:35 +#: lib/branch_delete.tcl:32 lib/branch_rename.tcl:30 lib/browser.tcl:282 - #: lib/checkout_op.tcl:522 lib/choose_font.tcl:43 lib/merge.tcl:171 ++#: lib/checkout_op.tcl:544 lib/choose_font.tcl:43 lib/merge.tcl:171 +#: lib/option.tcl:103 lib/remote_branch_delete.tcl:42 lib/transport.tcl:97 +msgid "Cancel" +msgstr "Annuler" + +#: lib/branch_checkout.tcl:32 lib/browser.tcl:287 +msgid "Revision" +msgstr "Révision" + - #: lib/branch_checkout.tcl:36 lib/branch_create.tcl:69 lib/option.tcl:242 ++#: lib/branch_checkout.tcl:36 lib/branch_create.tcl:69 lib/option.tcl:244 +msgid "Options" +msgstr "Options" + +#: lib/branch_checkout.tcl:39 lib/branch_create.tcl:92 +msgid "Fetch Tracking Branch" - msgstr "Branche suivant récupération" ++msgstr "Récupérer la branche de suivi" + +#: lib/branch_checkout.tcl:44 +msgid "Detach From Local Branch" - msgstr "Détacher de branche locale" ++msgstr "Détacher de la branche locale" + +#: lib/branch_create.tcl:22 +msgid "Create Branch" +msgstr "Créer branche" + +#: lib/branch_create.tcl:27 +msgid "Create New Branch" +msgstr "Créer nouvelle branche" + +#: lib/branch_create.tcl:31 lib/choose_repository.tcl:371 +msgid "Create" +msgstr "Créer" + +#: lib/branch_create.tcl:40 +msgid "Branch Name" +msgstr "Nom de branche" + +#: lib/branch_create.tcl:43 +msgid "Name:" +msgstr "Nom :" + +#: lib/branch_create.tcl:58 +msgid "Match Tracking Branch Name" +msgstr "Trouver nom de branche de suivi" + +#: lib/branch_create.tcl:66 +msgid "Starting Revision" - msgstr "Début de révision" ++msgstr "Révision initiale" + +#: lib/branch_create.tcl:72 +msgid "Update Existing Branch:" +msgstr "Mettre à jour branche existante :" + +#: lib/branch_create.tcl:75 +msgid "No" +msgstr "Non" + +#: lib/branch_create.tcl:80 +msgid "Fast Forward Only" - msgstr "Avance rapide seulement" ++msgstr "Mise-à-jour rectiligne seulement (fast-forward)" + - #: lib/branch_create.tcl:85 lib/checkout_op.tcl:514 ++#: lib/branch_create.tcl:85 lib/checkout_op.tcl:536 +msgid "Reset" +msgstr "Réinitialiser" + +#: lib/branch_create.tcl:97 +msgid "Checkout After Creation" - msgstr "Emprunt après création" ++msgstr "Charger (checkout) après création" + +#: lib/branch_create.tcl:131 +msgid "Please select a tracking branch." - msgstr "Merci de choisir une branche de suivi" ++msgstr "Choisissez une branche de suivi" + +#: lib/branch_create.tcl:140 +#, tcl-format +msgid "Tracking branch %s is not a branch in the remote repository." - msgstr "La branche de suivi %s n'est pas une branche dans le référentiel distant." ++msgstr "La branche de suivi %s n'est pas une branche dans le dépôt distant." + +#: lib/branch_create.tcl:153 lib/branch_rename.tcl:86 +msgid "Please supply a branch name." - msgstr "Merci de fournir un nom de branche." ++msgstr "Fournissez un nom de branche." + +#: lib/branch_create.tcl:164 lib/branch_rename.tcl:106 +#, tcl-format +msgid "'%s' is not an acceptable branch name." +msgstr "'%s' n'est pas un nom de branche acceptable." + +#: lib/branch_delete.tcl:15 +msgid "Delete Branch" +msgstr "Supprimer branche" + +#: lib/branch_delete.tcl:20 +msgid "Delete Local Branch" +msgstr "Supprimer branche locale" + +#: lib/branch_delete.tcl:37 +msgid "Local Branches" +msgstr "Branches locales" + +#: lib/branch_delete.tcl:52 +msgid "Delete Only If Merged Into" - msgstr "Supprimer ssi fusion dedans" ++msgstr "Supprimer seulement si fusionnée dans:" + +#: lib/branch_delete.tcl:54 +msgid "Always (Do not perform merge test.)" +msgstr "Toujours (Ne pas faire de test de fusion.)" + +#: lib/branch_delete.tcl:103 +#, tcl-format +msgid "The following branches are not completely merged into %s:" +msgstr "Les branches suivantes ne sont pas complètement fusionnées dans %s :" + +#: lib/branch_delete.tcl:115 +msgid "" +"Recovering deleted branches is difficult. \n" +"\n" +" Delete the selected branches?" +msgstr "" +"Récupérer des branches supprimées est difficile.\n" +"\n" +"Supprimer les branches sélectionnées ?" + +#: lib/branch_delete.tcl:141 +#, tcl-format +msgid "" +"Failed to delete branches:\n" +"%s" +msgstr "" +"La suppression des branches suivantes a échouée :\n" +"%s" + +#: lib/branch_rename.tcl:14 lib/branch_rename.tcl:22 +msgid "Rename Branch" +msgstr "Renommer branche" + +#: lib/branch_rename.tcl:26 +msgid "Rename" +msgstr "Renommer" + +#: lib/branch_rename.tcl:36 +msgid "Branch:" +msgstr "Branche :" + +#: lib/branch_rename.tcl:39 +msgid "New Name:" +msgstr "Nouveau nom :" + +#: lib/branch_rename.tcl:75 +msgid "Please select a branch to rename." +msgstr "Merci de sélectionner une branche à renommer." + - #: lib/branch_rename.tcl:96 lib/checkout_op.tcl:179 ++#: lib/branch_rename.tcl:96 lib/checkout_op.tcl:201 +#, tcl-format +msgid "Branch '%s' already exists." +msgstr "La branche '%s' existe déjà." + +#: lib/branch_rename.tcl:117 +#, tcl-format +msgid "Failed to rename '%s'." - msgstr "Le renommage de '%s' a échoué." ++msgstr "Échec pour renommer '%s'." + +#: lib/browser.tcl:17 +msgid "Starting..." +msgstr "Lancement..." + +#: lib/browser.tcl:26 +msgid "File Browser" +msgstr "Visionneur de fichier" + +#: lib/browser.tcl:126 lib/browser.tcl:143 +#, tcl-format +msgid "Loading %s..." +msgstr "Chargement de %s..." + +#: lib/browser.tcl:187 +msgid "[Up To Parent]" +msgstr "[Jusqu'au parent]" + +#: lib/browser.tcl:267 lib/browser.tcl:273 +msgid "Browse Branch Files" - msgstr "Visionner fichiers de branches" ++msgstr "Naviguer dans les fichiers de le branche" + +#: lib/browser.tcl:278 lib/choose_repository.tcl:387 - #: lib/choose_repository.tcl:474 lib/choose_repository.tcl:484 - #: lib/choose_repository.tcl:987 ++#: lib/choose_repository.tcl:472 lib/choose_repository.tcl:482 ++#: lib/choose_repository.tcl:985 +msgid "Browse" - msgstr "Visionner" ++msgstr "Naviguer" + - #: lib/checkout_op.tcl:79 ++#: lib/checkout_op.tcl:84 +#, tcl-format +msgid "Fetching %s from %s" +msgstr "Récupération de %s à partir de %s" + - #: lib/checkout_op.tcl:127 ++#: lib/checkout_op.tcl:132 +#, tcl-format +msgid "fatal: Cannot resolve %s" +msgstr "erreur fatale : Impossible de résoudre %s" + - #: lib/checkout_op.tcl:140 lib/console.tcl:81 lib/database.tcl:31 ++#: lib/checkout_op.tcl:145 lib/console.tcl:81 lib/database.tcl:31 +msgid "Close" +msgstr "Fermer" + - #: lib/checkout_op.tcl:169 ++#: lib/checkout_op.tcl:174 +#, tcl-format +msgid "Branch '%s' does not exist." +msgstr "La branche '%s' n'existe pas." + - #: lib/checkout_op.tcl:206 ++#: lib/checkout_op.tcl:193 ++#, tcl-format ++msgid "Failed to configure simplified git-pull for '%s'." ++msgstr "Échec de la configuration simplifiée de git-pull pour '%s'." ++ ++#: lib/checkout_op.tcl:228 +#, tcl-format +msgid "" +"Branch '%s' already exists.\n" +"\n" +"It cannot fast-forward to %s.\n" +"A merge is required." +msgstr "" +"La branche '%s' existe déjà.\n" +"\n" - "Impossible d'avancer rapidement à %s.\n" ++"Impossible de faire une avance rapide (fast forward) vers %s.\n" +"Une fusion est nécessaire." + - #: lib/checkout_op.tcl:220 ++#: lib/checkout_op.tcl:242 +#, tcl-format +msgid "Merge strategy '%s' not supported." +msgstr "La stratégie de fusion '%s' n'est pas supportée." + - #: lib/checkout_op.tcl:239 ++#: lib/checkout_op.tcl:261 +#, tcl-format +msgid "Failed to update '%s'." +msgstr "La mise à jour de '%s' a échouée." + - #: lib/checkout_op.tcl:251 ++#: lib/checkout_op.tcl:273 +msgid "Staging area (index) is already locked." - msgstr "L'espace de pré-commit ('index' ou 'staging') est déjà vérouillé." ++msgstr "L'index (staging area) est déjà vérouillé" + - #: lib/checkout_op.tcl:266 ++#: lib/checkout_op.tcl:288 +msgid "" +"Last scanned state does not match repository state.\n" +"\n" +"Another Git program has modified this repository since the last scan. A " +"rescan must be performed before the current branch can be changed.\n" +"\n" +"The rescan will be automatically started now.\n" +msgstr "" - "L'état lors de la dernière synchronisation ne correspond plus à l'état du référentiel.\n" ++"L'état lors de la dernière synchronisation ne correspond plus à l'état du " ++"dépôt\n" +"\n" - "Un autre programme Git a modifié ce référentiel depuis la dernière synchronisation. Une resynchronisation doit être effectuée avant de pouvoir modifier la branche courante.\n" ++"Un autre programme Git a modifié ce dépôt depuis la dernière " ++"synchronisation. Une resynchronisation doit être effectuée avant de pouvoir " ++"modifier la branche courante.\n" +"\n" +"Cela va être fait tout de suite automatiquement.\n" + - #: lib/checkout_op.tcl:322 ++#: lib/checkout_op.tcl:344 +#, tcl-format +msgid "Updating working directory to '%s'..." +msgstr "Mise à jour du répertoire courant avec '%s'..." + - #: lib/checkout_op.tcl:323 ++#: lib/checkout_op.tcl:345 +msgid "files checked out" - msgstr "fichiers empruntés" ++msgstr "fichiers chargés" + - #: lib/checkout_op.tcl:353 ++#: lib/checkout_op.tcl:375 +#, tcl-format +msgid "Aborted checkout of '%s' (file level merging is required)." - msgstr "Emprunt de '%s' abandonné. (Il est nécessaire de fusionner des fichiers.)" ++msgstr "Chargement de '%s' abandonné (il est nécessaire de fusionner des fichiers)." + - #: lib/checkout_op.tcl:354 ++#: lib/checkout_op.tcl:376 +msgid "File level merge required." +msgstr "Il est nécessaire de fusionner des fichiers." + - #: lib/checkout_op.tcl:358 ++#: lib/checkout_op.tcl:380 +#, tcl-format +msgid "Staying on branch '%s'." +msgstr "Le répertoire de travail reste sur la branche '%s'." + - #: lib/checkout_op.tcl:429 ++#: lib/checkout_op.tcl:451 +msgid "" +"You are no longer on a local branch.\n" +"\n" +"If you wanted to be on a branch, create one now starting from 'This Detached " +"Checkout'." +msgstr "" +"Vous n'êtes plus ur une branche locale.\n" +"\n" +"Si vous vouliez être sur une branche, créez en une maintenant en partant de " +"'Cet emprunt détaché'." + - #: lib/checkout_op.tcl:446 lib/checkout_op.tcl:450 ++#: lib/checkout_op.tcl:468 lib/checkout_op.tcl:472 +#, tcl-format +msgid "Checked out '%s'." - msgstr "'%s' emprunté." ++msgstr "'%s' chargé." + - #: lib/checkout_op.tcl:478 ++#: lib/checkout_op.tcl:500 +#, tcl-format +msgid "Resetting '%s' to '%s' will lose the following commits:" +msgstr "Réinitialiser '%s' à '%s' va faire perdre les commits suivants :" + - #: lib/checkout_op.tcl:500 ++#: lib/checkout_op.tcl:522 +msgid "Recovering lost commits may not be easy." +msgstr "Récupérer les commits perdus ne sera peut être pas facile." + - #: lib/checkout_op.tcl:505 ++#: lib/checkout_op.tcl:527 +#, tcl-format +msgid "Reset '%s'?" +msgstr "Réinitialiser '%s' ?" + - #: lib/checkout_op.tcl:510 lib/merge.tcl:163 ++#: lib/checkout_op.tcl:532 lib/merge.tcl:163 +msgid "Visualize" +msgstr "Visualiser" + - #: lib/checkout_op.tcl:578 ++#: lib/checkout_op.tcl:600 +#, tcl-format +msgid "" +"Failed to set current branch.\n" +"\n" +"This working directory is only partially switched. We successfully updated " +"your files, but failed to update an internal Git file.\n" +"\n" +"This should not have occurred. %s will now close and give up." +msgstr "" +"Le changement de la branche courante a échoué.\n" +"\n" +"Le répertoire courant n'est que partiellement modifié. Les fichiers ont été " +"mis à jour avec succès, mais la mise à jour d'un fichier interne à Git a " +"échouée.\n" +"\n" +"Cela n'aurait pas du se produire. %s va abandonner et se terminer." + +#: lib/choose_font.tcl:39 +msgid "Select" +msgstr "Sélectionner" + +#: lib/choose_font.tcl:53 +msgid "Font Family" - msgstr "Famille de fonte" ++msgstr "Familles de polices" + +#: lib/choose_font.tcl:74 +msgid "Font Size" - msgstr "Taille de fonte" ++msgstr "Taille de police" + +#: lib/choose_font.tcl:91 +msgid "Font Example" - msgstr "Exemple de fonte" ++msgstr "Exemple de police" + +#: lib/choose_font.tcl:103 +msgid "" +"This is example text.\n" +"If you like this text, it can be your font." +msgstr "" +"C'est un texte d'exemple.\n" - "Si vous aimez ce texte, vous pouvez choisir cette fonte." ++"Si vous aimez ce texte, vous pouvez choisir cette police" + +#: lib/choose_repository.tcl:28 +msgid "Git Gui" +msgstr "Git Gui" + +#: lib/choose_repository.tcl:81 lib/choose_repository.tcl:376 +msgid "Create New Repository" - msgstr "Créer nouveau référentiel" ++msgstr "Créer nouveau dépôt" + +#: lib/choose_repository.tcl:87 +msgid "New..." +msgstr "Nouveau..." + - #: lib/choose_repository.tcl:94 lib/choose_repository.tcl:460 ++#: lib/choose_repository.tcl:94 lib/choose_repository.tcl:458 +msgid "Clone Existing Repository" - msgstr "Cloner référentiel existant" ++msgstr "Cloner dépôt existant" + +#: lib/choose_repository.tcl:100 +msgid "Clone..." +msgstr "Cloner..." + - #: lib/choose_repository.tcl:107 lib/choose_repository.tcl:976 ++#: lib/choose_repository.tcl:107 lib/choose_repository.tcl:974 +msgid "Open Existing Repository" - msgstr "Ouvrir référentiel existant" ++msgstr "Ouvrir dépôt existant" + +#: lib/choose_repository.tcl:113 +msgid "Open..." +msgstr "Ouvrir..." + +#: lib/choose_repository.tcl:126 +msgid "Recent Repositories" - msgstr "Référentiels récents" ++msgstr "Dépôt récemment utilisés" + +#: lib/choose_repository.tcl:132 +msgid "Open Recent Repository:" - msgstr "Ouvrir référentiel récent :" ++msgstr "Ouvrir dépôt récent :" + +#: lib/choose_repository.tcl:296 lib/choose_repository.tcl:303 +#: lib/choose_repository.tcl:310 +#, tcl-format +msgid "Failed to create repository %s:" - msgstr "La création du référentiel %s a échouée :" ++msgstr "La création du dépôt %s a échouée :" + - #: lib/choose_repository.tcl:381 lib/choose_repository.tcl:478 ++#: lib/choose_repository.tcl:381 lib/choose_repository.tcl:476 +msgid "Directory:" +msgstr "Répertoire :" + - #: lib/choose_repository.tcl:412 lib/choose_repository.tcl:537 - #: lib/choose_repository.tcl:1011 ++#: lib/choose_repository.tcl:410 lib/choose_repository.tcl:535 ++#: lib/choose_repository.tcl:1007 +msgid "Git Repository" - msgstr "Référentiel Git" ++msgstr "Dépôt Git" + - #: lib/choose_repository.tcl:437 ++#: lib/choose_repository.tcl:435 +#, tcl-format +msgid "Directory %s already exists." +msgstr "Le répertoire %s existe déjà." + - #: lib/choose_repository.tcl:441 ++#: lib/choose_repository.tcl:439 +#, tcl-format +msgid "File %s already exists." +msgstr "Le fichier %s existe déjà." + - #: lib/choose_repository.tcl:455 ++#: lib/choose_repository.tcl:453 +msgid "Clone" +msgstr "Cloner" + - #: lib/choose_repository.tcl:468 ++#: lib/choose_repository.tcl:466 +msgid "URL:" +msgstr "URL :" + - #: lib/choose_repository.tcl:489 ++#: lib/choose_repository.tcl:487 +msgid "Clone Type:" +msgstr "Type de clonage :" + - #: lib/choose_repository.tcl:495 ++#: lib/choose_repository.tcl:493 +msgid "Standard (Fast, Semi-Redundant, Hardlinks)" +msgstr "Standard (rapide, semi-redondant, liens durs)" + - #: lib/choose_repository.tcl:501 ++#: lib/choose_repository.tcl:499 +msgid "Full Copy (Slower, Redundant Backup)" +msgstr "Copy complète (plus lent, sauvegarde redondante)" + - #: lib/choose_repository.tcl:507 ++#: lib/choose_repository.tcl:505 +msgid "Shared (Fastest, Not Recommended, No Backup)" +msgstr "Partagé (le plus rapide, non recommandé, pas de sauvegarde)" + - #: lib/choose_repository.tcl:543 lib/choose_repository.tcl:590 - #: lib/choose_repository.tcl:736 lib/choose_repository.tcl:806 - #: lib/choose_repository.tcl:1017 lib/choose_repository.tcl:1025 ++#: lib/choose_repository.tcl:541 lib/choose_repository.tcl:588 ++#: lib/choose_repository.tcl:734 lib/choose_repository.tcl:804 ++#: lib/choose_repository.tcl:1013 lib/choose_repository.tcl:1021 +#, tcl-format +msgid "Not a Git repository: %s" - msgstr "'%s' n'est pas un référentiel Git." ++msgstr "'%s' n'est pas un dépôt Git." + - #: lib/choose_repository.tcl:579 ++#: lib/choose_repository.tcl:577 +msgid "Standard only available for local repository." - msgstr "Standard n'est disponible que pour un référentiel local." ++msgstr "Standard n'est disponible que pour un dépôt local." + - #: lib/choose_repository.tcl:583 ++#: lib/choose_repository.tcl:581 +msgid "Shared only available for local repository." - msgstr "Partagé n'est disponible que pour un référentiel local." ++msgstr "Partagé n'est disponible que pour un dépôt local." + - #: lib/choose_repository.tcl:604 ++#: lib/choose_repository.tcl:602 +#, tcl-format +msgid "Location %s already exists." +msgstr "L'emplacement %s existe déjà." + - #: lib/choose_repository.tcl:615 ++#: lib/choose_repository.tcl:613 +msgid "Failed to configure origin" +msgstr "La configuration de l'origine a échouée." + - #: lib/choose_repository.tcl:627 ++#: lib/choose_repository.tcl:625 +msgid "Counting objects" - msgstr "Comptage des objets" ++msgstr "Décompte des objets" + - #: lib/choose_repository.tcl:628 ++#: lib/choose_repository.tcl:626 +msgid "buckets" +msgstr "paniers" + - #: lib/choose_repository.tcl:652 ++#: lib/choose_repository.tcl:650 +#, tcl-format +msgid "Unable to copy objects/info/alternates: %s" +msgstr "Impossible de copier 'objects/info/alternates' : %s" + - #: lib/choose_repository.tcl:688 ++#: lib/choose_repository.tcl:686 +#, tcl-format +msgid "Nothing to clone from %s." +msgstr "Il n'y a rien à cloner depuis %s." + - #: lib/choose_repository.tcl:690 lib/choose_repository.tcl:904 - #: lib/choose_repository.tcl:916 ++#: lib/choose_repository.tcl:688 lib/choose_repository.tcl:902 ++#: lib/choose_repository.tcl:914 +msgid "The 'master' branch has not been initialized." - msgstr "Cette branche 'master' n'a pas été initialisée." ++msgstr "La branche 'master' n'a pas été initialisée." + - #: lib/choose_repository.tcl:703 ++#: lib/choose_repository.tcl:701 +msgid "Hardlinks are unavailable. Falling back to copying." - msgstr "Les liens durs ne sont pas disponibles. On se résoud à copier." ++msgstr "Les liens durs ne sont pas supportés. Une copie sera effectuée à la place." + - #: lib/choose_repository.tcl:715 ++#: lib/choose_repository.tcl:713 +#, tcl-format +msgid "Cloning from %s" +msgstr "Clonage depuis %s" + - #: lib/choose_repository.tcl:746 ++#: lib/choose_repository.tcl:744 +msgid "Copying objects" +msgstr "Copie des objets" + - #: lib/choose_repository.tcl:747 ++#: lib/choose_repository.tcl:745 +msgid "KiB" +msgstr "KiB" + - #: lib/choose_repository.tcl:771 ++#: lib/choose_repository.tcl:769 +#, tcl-format +msgid "Unable to copy object: %s" +msgstr "Impossible de copier l'objet : %s" + - #: lib/choose_repository.tcl:781 ++#: lib/choose_repository.tcl:779 +msgid "Linking objects" +msgstr "Liaison des objets" + - #: lib/choose_repository.tcl:782 ++#: lib/choose_repository.tcl:780 +msgid "objects" +msgstr "objets" + - #: lib/choose_repository.tcl:790 ++#: lib/choose_repository.tcl:788 +#, tcl-format +msgid "Unable to hardlink object: %s" +msgstr "Impossible créer un lien dur pour l'objet : %s" + - #: lib/choose_repository.tcl:845 ++#: lib/choose_repository.tcl:843 +msgid "Cannot fetch branches and objects. See console output for details." +msgstr "" +"Impossible de récupérer les branches et objets. Voir la sortie console pour " +"plus de détails." + - #: lib/choose_repository.tcl:856 ++#: lib/choose_repository.tcl:854 +msgid "Cannot fetch tags. See console output for details." +msgstr "" - "Impossible de récupérer les marques. Voir la sortie console pour plus de " - "détails." ++"Impossible de récupérer les marques (tags). Voir la sortie console pour plus " ++"de détails." + - #: lib/choose_repository.tcl:880 ++#: lib/choose_repository.tcl:878 +msgid "Cannot determine HEAD. See console output for details." +msgstr "Impossible de déterminer HEAD. Voir la sortie console pour plus de détails." + - #: lib/choose_repository.tcl:889 ++#: lib/choose_repository.tcl:887 +#, tcl-format +msgid "Unable to cleanup %s" +msgstr "Impossible de nettoyer %s" + - #: lib/choose_repository.tcl:895 ++#: lib/choose_repository.tcl:893 +msgid "Clone failed." +msgstr "Le clonage a échoué." + - #: lib/choose_repository.tcl:902 ++#: lib/choose_repository.tcl:900 +msgid "No default branch obtained." +msgstr "Aucune branche par défaut n'a été obtenue." + - #: lib/choose_repository.tcl:913 ++#: lib/choose_repository.tcl:911 +#, tcl-format +msgid "Cannot resolve %s as a commit." +msgstr "Impossible de résoudre %s comme commit." + - #: lib/choose_repository.tcl:925 ++#: lib/choose_repository.tcl:923 +msgid "Creating working directory" +msgstr "Création du répertoire de travail" + - #: lib/choose_repository.tcl:926 lib/index.tcl:65 lib/index.tcl:127 ++#: lib/choose_repository.tcl:924 lib/index.tcl:65 lib/index.tcl:127 +#: lib/index.tcl:193 +msgid "files" +msgstr "fichiers" + - #: lib/choose_repository.tcl:955 ++#: lib/choose_repository.tcl:953 +msgid "Initial file checkout failed." - msgstr "L'emprunt initial de fichier a échoué." ++msgstr "Chargement initial du fichier échoué." + - #: lib/choose_repository.tcl:971 ++#: lib/choose_repository.tcl:969 +msgid "Open" +msgstr "Ouvrir" + - #: lib/choose_repository.tcl:981 ++#: lib/choose_repository.tcl:979 +msgid "Repository:" - msgstr "Référentiel :" ++msgstr "Dépôt :" + - #: lib/choose_repository.tcl:1031 ++#: lib/choose_repository.tcl:1027 +#, tcl-format +msgid "Failed to open repository %s:" - msgstr "Impossible d'ouvrir le référentiel %s :" ++msgstr "Impossible d'ouvrir le dépôt %s :" + +#: lib/choose_rev.tcl:53 +msgid "This Detached Checkout" +msgstr "Cet emprunt détaché" + +#: lib/choose_rev.tcl:60 +msgid "Revision Expression:" +msgstr "Expression de révision :" + +#: lib/choose_rev.tcl:74 +msgid "Local Branch" +msgstr "Branche locale" + +#: lib/choose_rev.tcl:79 +msgid "Tracking Branch" - msgstr "Suivi de branche" ++msgstr "Branche de suivi" + +#: lib/choose_rev.tcl:84 lib/choose_rev.tcl:538 +msgid "Tag" - msgstr "Marque" ++msgstr "Marque (tag)" + +#: lib/choose_rev.tcl:317 +#, tcl-format +msgid "Invalid revision: %s" +msgstr "Révision invalide : %s" + +#: lib/choose_rev.tcl:338 +msgid "No revision selected." +msgstr "Pas de révision selectionnée." + +#: lib/choose_rev.tcl:346 +msgid "Revision expression is empty." +msgstr "L'expression de révision est vide." + +#: lib/choose_rev.tcl:531 +msgid "Updated" - msgstr "Misa à jour" ++msgstr "Mise-à-jour:" + +#: lib/choose_rev.tcl:559 +msgid "URL" +msgstr "URL" + +#: lib/commit.tcl:9 +msgid "" +"There is nothing to amend.\n" +"\n" +"You are about to create the initial commit. There is no commit before this " +"to amend.\n" +msgstr "" +"Il n'y a rien à corriger.\n" +"\n" +"Vous allez créer le commit initial. Il n'y a pas de commit avant celui-ci à " +"corriger.\n" + +#: lib/commit.tcl:18 +msgid "" +"Cannot amend while merging.\n" +"\n" +"You are currently in the middle of a merge that has not been fully " +"completed. You cannot amend the prior commit unless you first abort the " +"current merge activity.\n" +msgstr "" +"Impossible de corriger pendant une fusion.\n" +"\n" +"Vous êtes actuellement au milieu d'une fusion qui n'a pas été completement " +"terminée. Vous ne pouvez pas corriger le commit précédant sauf si vous " +"abandonnez la fusion courante.\n" + +#: lib/commit.tcl:49 +msgid "Error loading commit data for amend:" +msgstr "Erreur lors du chargement des données de commit pour correction :" + +#: lib/commit.tcl:76 +msgid "Unable to obtain your identity:" +msgstr "Impossible d'obtenir votre identité :" + +#: lib/commit.tcl:81 +msgid "Invalid GIT_COMMITTER_IDENT:" +msgstr "GIT_COMMITTER_IDENT invalide :" + +#: lib/commit.tcl:133 +msgid "" +"Last scanned state does not match repository state.\n" +"\n" +"Another Git program has modified this repository since the last scan. A " +"rescan must be performed before another commit can be created.\n" +"\n" +"The rescan will be automatically started now.\n" +msgstr "" +"L'état lors de la dernière synchronisation ne correspond plus à l'état du " - "référentiel.\n" ++"dépôt.\n" +"\n" - "Un autre programme Git a modifié ce référentiel depuis la dernière " ++"Un autre programme Git a modifié ce dépôt depuis la dernière " +"synchronisation. Une resynshronisation doit être effectuée avant de pouvoir " +"créer un nouveau commit.\n" +"\n" +"Cela va être fait tout de suite automatiquement.\n" + +#: lib/commit.tcl:154 +#, tcl-format +msgid "" +"Unmerged files cannot be committed.\n" +"\n" +"File %s has merge conflicts. You must resolve them and stage the file " +"before committing.\n" +msgstr "" +"Des fichiers non fusionnés ne peuvent être commités.\n" +"\n" +"Le fichier %s a des conflicts de fusion. Vous devez les résoudre et pré-" +"commiter le fichier avant de pouvoir commiter.\n" + +#: lib/commit.tcl:162 +#, tcl-format +msgid "" +"Unknown file state %s detected.\n" +"\n" +"File %s cannot be committed by this program.\n" +msgstr "" +"Un état de fichier inconnu %s a été détecté.\n" +"\n" +"Le fichier %s ne peut pas être commité par ce programme.\n" + +#: lib/commit.tcl:170 +msgid "" +"No changes to commit.\n" +"\n" +"You must stage at least 1 file before you can commit.\n" +msgstr "" +"Pas de modification à commiter.\n" +"\n" - "Vous devez pré-commiter au moins 1 fichier avant de pouvoir commiter.\n" ++"Vous devez indexer au moins 1 fichier avant de pouvoir commiter.\n" + +#: lib/commit.tcl:183 +msgid "" +"Please supply a commit message.\n" +"\n" +"A good commit message has the following format:\n" +"\n" +"- First line: Describe in one sentence what you did.\n" +"- Second line: Blank\n" +"- Remaining lines: Describe why this change is good.\n" +msgstr "" +"Merci de fournir un message de commit.\n" +"\n" +"Un bon message de commit a le format suivant :\n" +"\n" +"- Première ligne : décrire en une phrase ce que vous avez fait.\n" +"- Deuxième ligne : rien.\n" +"- Lignes suivantes : Décrire pourquoi ces modifications sont bonnes.\n" + +#: lib/commit.tcl:207 +#, tcl-format +msgid "warning: Tcl does not support encoding '%s'." +msgstr "attention : Tcl ne supporte pas l'encodage '%s'." + +#: lib/commit.tcl:221 +msgid "Calling pre-commit hook..." - msgstr "Appel du programme externe d'avant commit..." ++msgstr "Lancement de l'action d'avant-commit..." + +#: lib/commit.tcl:236 +msgid "Commit declined by pre-commit hook." - msgstr "Commit refusé par le programme externe d'avant commit." ++msgstr "Commit refusé par l'action d'avant-commit." + +#: lib/commit.tcl:259 +msgid "Calling commit-msg hook..." - msgstr "Appel du programme externe de message de commit..." ++msgstr "Lancement de l'action \"message de commit\"..." + +#: lib/commit.tcl:274 +msgid "Commit declined by commit-msg hook." - msgstr "Commit refusé par le programme externe de message de commit." ++msgstr "Commit refusé par l'action \"message de commit\"." + +#: lib/commit.tcl:287 +msgid "Committing changes..." +msgstr "Commit des modifications..." + +#: lib/commit.tcl:303 +msgid "write-tree failed:" +msgstr "write-tree a échoué :" + +#: lib/commit.tcl:304 lib/commit.tcl:348 lib/commit.tcl:368 +msgid "Commit failed." +msgstr "Le commit a échoué." + +#: lib/commit.tcl:321 +#, tcl-format +msgid "Commit %s appears to be corrupt" +msgstr "Le commit %s semble être corrompu" + +#: lib/commit.tcl:326 +msgid "" +"No changes to commit.\n" +"\n" +"No files were modified by this commit and it was not a merge commit.\n" +"\n" +"A rescan will be automatically started now.\n" +msgstr "" +"Pas de modification à commiter.\n" +"\n" +"Aucun fichier n'a été modifié par ce commit et il ne s'agit pas d'un commit " +"de fusion.\n" +"\n" +"Une resynchronisation va être lancée tout de suite automatiquement.\n" + +#: lib/commit.tcl:333 +msgid "No changes to commit." +msgstr "Pas de modifications à commiter." + +#: lib/commit.tcl:347 +msgid "commit-tree failed:" +msgstr "commit-tree a échoué :" + +#: lib/commit.tcl:367 +msgid "update-ref failed:" +msgstr "update-ref a échoué" + +#: lib/commit.tcl:454 +#, tcl-format +msgid "Created commit %s: %s" +msgstr "Commit créé %s : %s" + +#: lib/console.tcl:59 +msgid "Working... please wait..." +msgstr "Travail en cours... merci de patienter..." + +#: lib/console.tcl:186 +msgid "Success" +msgstr "Succès" + +#: lib/console.tcl:200 +msgid "Error: Command Failed" +msgstr "Erreur : échec de la commande" + +#: lib/database.tcl:43 +msgid "Number of loose objects" +msgstr "Nombre d'objets en fichier particulier" + +#: lib/database.tcl:44 +msgid "Disk space used by loose objects" +msgstr "Espace disque utilisé par les fichiers particuliers" + +#: lib/database.tcl:45 +msgid "Number of packed objects" +msgstr "Nombre d'objets empaquetés" + +#: lib/database.tcl:46 +msgid "Number of packs" +msgstr "Nombre de paquets d'objets" + +#: lib/database.tcl:47 +msgid "Disk space used by packed objects" +msgstr "Espace disque utilisé par les objets empaquetés" + +#: lib/database.tcl:48 +msgid "Packed objects waiting for pruning" +msgstr "Objets empaquetés attendant d'être supprimés" + +#: lib/database.tcl:49 +msgid "Garbage files" +msgstr "Fichiers poubelle" + +#: lib/database.tcl:72 +msgid "Compressing the object database" +msgstr "Compression de la base des objets" + +#: lib/database.tcl:83 +msgid "Verifying the object database with fsck-objects" +msgstr "Vérification de la base des objets avec fsck-objects" + +#: lib/database.tcl:108 +#, tcl-format +msgid "" +"This repository currently has approximately %i loose objects.\n" +"\n" +"To maintain optimal performance it is strongly recommended that you compress " +"the database when more than %i loose objects exist.\n" +"\n" +"Compress the database now?" +msgstr "" - "Ce référentiel comprend actuellement environ %i objets ayant leur fichier " ++"Ce dépôt comprend actuellement environ %i objets ayant leur fichier " +"particulier.\n" +"\n" +"Pour conserver une performance optimale, il est fortement recommandé de " +"comprimer la base quand plus de %i objets ayant leur fichier particulier " +"existent.\n" +"\n" +"Comprimer la base maintenant ?" + +#: lib/date.tcl:25 +#, tcl-format +msgid "Invalid date from Git: %s" +msgstr "Date invalide de Git : %s" + - #: lib/diff.tcl:42 ++#: lib/diff.tcl:44 +#, tcl-format +msgid "" +"No differences detected.\n" +"\n" +"%s has no changes.\n" +"\n" +"The modification date of this file was updated by another application, but " +"the content within the file was not changed.\n" +"\n" +"A rescan will be automatically started to find other files which may have " +"the same state." +msgstr "" +"Aucune différence détectée.\n" +"\n" +"%s ne comporte aucune modification.\n" +"\n" +"La date de modification de ce fichier a été mise à jour par une autre " +"application, mais le contenu du fichier n'a pas changé.\n" +"\n" +"Une resynchronisation va être lancée automatiquement pour trouver d'autres " +"fichiers qui pourraient se trouver dans le même état." + - #: lib/diff.tcl:81 ++#: lib/diff.tcl:83 +#, tcl-format +msgid "Loading diff of %s..." +msgstr "Chargement des différences de %s..." + - #: lib/diff.tcl:114 lib/diff.tcl:184 ++#: lib/diff.tcl:116 lib/diff.tcl:190 +#, tcl-format +msgid "Unable to display %s" +msgstr "Impossible d'afficher %s" + - #: lib/diff.tcl:115 ++#: lib/diff.tcl:117 +msgid "Error loading file:" +msgstr "Erreur lors du chargement du fichier :" + - #: lib/diff.tcl:122 ++#: lib/diff.tcl:124 +msgid "Git Repository (subproject)" - msgstr "Référentiel Git (sous projet)" ++msgstr "Dépôt Git (sous projet)" + - #: lib/diff.tcl:134 ++#: lib/diff.tcl:136 +msgid "* Binary file (not showing content)." +msgstr "* Fichier binaire (pas d'apperçu du contenu)." + - #: lib/diff.tcl:185 ++#: lib/diff.tcl:191 +msgid "Error loading diff:" +msgstr "Erreur lors du chargement des différences :" + - #: lib/diff.tcl:303 ++#: lib/diff.tcl:313 +msgid "Failed to unstage selected hunk." - msgstr "La suppression dans le pré-commit de la section sélectionnée a échouée." ++msgstr "Échec lors de la désindexation de la section sélectionnée." + - #: lib/diff.tcl:310 ++#: lib/diff.tcl:320 +msgid "Failed to stage selected hunk." - msgstr "Le pré-commit de la section sélectionnée a échoué." ++msgstr "Échec lors de l'indexation de la section." ++ ++#: lib/diff.tcl:386 ++msgid "Failed to unstage selected line." ++msgstr "Échec lors de la désindexation de la ligne sélectionnée." ++ ++#: lib/diff.tcl:394 ++msgid "Failed to stage selected line." ++msgstr "Échec lors de l'indexation de la ligne." + +#: lib/error.tcl:20 lib/error.tcl:114 +msgid "error" +msgstr "erreur" + +#: lib/error.tcl:36 +msgid "warning" +msgstr "attention" + +#: lib/error.tcl:94 +msgid "You must correct the above errors before committing." +msgstr "Vous devez corriger les erreurs suivantes avant de pouvoir commiter." + +#: lib/index.tcl:6 +msgid "Unable to unlock the index." - msgstr "Impossible de dévérouiller le pré-commit." ++msgstr "Impossible de dévérouiller l'index." + +#: lib/index.tcl:15 +msgid "Index Error" - msgstr "Erreur de pré-commit" ++msgstr "Erreur de l'index" + +#: lib/index.tcl:21 +msgid "" +"Updating the Git index failed. A rescan will be automatically started to " +"resynchronize git-gui." - msgstr "Le pré-commit a échoué. Une resynchronisation va être lancée automatiquement." ++msgstr "" ++"Échec de la mise à jour de l'index. Une resynchronisation va être lancée " ++"automatiquement." + +#: lib/index.tcl:27 +msgid "Continue" +msgstr "Continuer" + +#: lib/index.tcl:31 +msgid "Unlock Index" - msgstr "Dévérouiller le pré-commit" ++msgstr "Déverouiller l'index" + +#: lib/index.tcl:282 +#, tcl-format +msgid "Unstaging %s from commit" - msgstr "Supprimer %s du commit" ++msgstr "Désindexation de: %s" + +#: lib/index.tcl:313 +msgid "Ready to commit." +msgstr "Prêt à être commité." + +#: lib/index.tcl:326 +#, tcl-format +msgid "Adding %s" - msgstr "Ajouter %s" ++msgstr "Ajout de %s" + +#: lib/index.tcl:381 +#, tcl-format +msgid "Revert changes in file %s?" - msgstr "Inverser les modifications dans le fichier %s ? " ++msgstr "Annuler les modifications dans le fichier %s ? " + +#: lib/index.tcl:383 +#, tcl-format +msgid "Revert changes in these %i files?" - msgstr "Inverser les modifications dans ces %i fichiers ?" ++msgstr "Annuler les modifications dans ces %i fichiers ?" + +#: lib/index.tcl:391 +msgid "Any unstaged changes will be permanently lost by the revert." +msgstr "" - "Toutes les modifications non pré-commitées seront définitivement perdues " - "lors de l'inversion." ++"Toutes les modifications non-indexées seront définitivement perdues par " ++"l'annulation." + +#: lib/index.tcl:394 +msgid "Do Nothing" +msgstr "Ne rien faire" + +#: lib/merge.tcl:13 +msgid "" +"Cannot merge while amending.\n" +"\n" +"You must finish amending this commit before starting any type of merge.\n" +msgstr "" - "Impossible de fucionner pendant une correction.\n" ++"Impossible de fusionner pendant une correction.\n" +"\n" +"Vous devez finir de corriger ce commit avant de lancer une quelconque " +"fusion.\n" + +#: lib/merge.tcl:27 +msgid "" +"Last scanned state does not match repository state.\n" +"\n" +"Another Git program has modified this repository since the last scan. A " +"rescan must be performed before a merge can be performed.\n" +"\n" +"The rescan will be automatically started now.\n" +msgstr "" +"L'état lors de la dernière synchronisation ne correspond plus à l'état du " - "référentiel.\n" ++"dépôt.\n" +"\n" - "Un autre programme Git a modifié ce référentiel depuis la dernière " ++"Un autre programme Git a modifié ce dépôt depuis la dernière " +"synchronisation. Une resynchronisation doit être effectuée avant de pouvoir " +"fusionner de nouveau.\n" +"\n" +"Cela va être fait tout de suite automatiquement\n" + +#: lib/merge.tcl:44 +#, tcl-format +msgid "" +"You are in the middle of a conflicted merge.\n" +"\n" +"File %s has merge conflicts.\n" +"\n" +"You must resolve them, stage the file, and commit to complete the current " +"merge. Only then can you begin another merge.\n" +msgstr "" +"Vous êtes au milieu d'une fusion conflictuelle.\n" +"\n" +"Le fichier %s a des conflicts de fusion.\n" +"\n" - "Vous devez les résoudre, puis pré-commiter le fichier, et enfin commiter " - "pour terminer la fusion courante. Seulementà ce moment là, il sera possible " ++"Vous devez les résoudre, puis indexer le fichier, et enfin commiter pour " ++"terminer la fusion courante. Seulement à ce moment là sera-t-il possible " +"d'effectuer une nouvelle fusion.\n" + +#: lib/merge.tcl:54 +#, tcl-format +msgid "" +"You are in the middle of a change.\n" +"\n" +"File %s is modified.\n" +"\n" +"You should complete the current commit before starting a merge. Doing so " +"will help you abort a failed merge, should the need arise.\n" +msgstr "" +"Vous êtes au milieu d'une modification.\n" +"\n" +"Le fichier %s est modifié.\n" +"\n" +"Vous devriez terminer le commit courant avant de lancer une fusion. En " +"faisait comme cela, vous éviterez de devoir éventuellement abandonner une " +"fusion ayant échouée.\n" + +#: lib/merge.tcl:106 +#, tcl-format +msgid "%s of %s" +msgstr "%s de %s" + +#: lib/merge.tcl:119 +#, tcl-format +msgid "Merging %s and %s..." +msgstr "Fusion de %s et %s..." + +#: lib/merge.tcl:130 +msgid "Merge completed successfully." +msgstr "La fusion s'est faite avec succès." + +#: lib/merge.tcl:132 +msgid "Merge failed. Conflict resolution is required." +msgstr "La fusion a echouée. Il est nécessaire de résoudre les conflicts." + +#: lib/merge.tcl:157 +#, tcl-format +msgid "Merge Into %s" +msgstr "Fusion dans %s" + +#: lib/merge.tcl:176 +msgid "Revision To Merge" +msgstr "Révision à fusionner" + +#: lib/merge.tcl:211 +msgid "" +"Cannot abort while amending.\n" +"\n" +"You must finish amending this commit.\n" +msgstr "" +"Impossible d'abandonner en cours de correction.\n" +"\n" +"Vous devez finir de corriger ce commit.\n" + +#: lib/merge.tcl:221 +msgid "" +"Abort merge?\n" +"\n" +"Aborting the current merge will cause *ALL* uncommitted changes to be lost.\n" +"\n" +"Continue with aborting the current merge?" +msgstr "" +"Abandonner la fusion ?\n" +"\n" +"Abandonner la fusion courante entrainera la perte de TOUTES les " +"modifications non commitées.\n" +"\n" +"Abandonner quand même la fusion courante ?" + +#: lib/merge.tcl:227 +msgid "" +"Reset changes?\n" +"\n" +"Resetting the changes will cause *ALL* uncommitted changes to be lost.\n" +"\n" +"Continue with resetting the current changes?" +msgstr "" +"Réinitialiser les modifications ?\n" +"\n" +"Réinitialiser les modifications va faire perdre TOUTES les modifications non " +"commitées.\n" +"\n" +"Réinitialiser quand même les modifications courantes ?" + +#: lib/merge.tcl:238 +msgid "Aborting" +msgstr "Abandon" + +#: lib/merge.tcl:238 +msgid "files reset" +msgstr "fichiers réinitialisés" + - #: lib/merge.tcl:265 ++#: lib/merge.tcl:266 +msgid "Abort failed." +msgstr "L'abandon a échoué." + - #: lib/merge.tcl:267 ++#: lib/merge.tcl:268 +msgid "Abort completed. Ready." +msgstr "Abandon teminé. Prêt." + +#: lib/option.tcl:95 +msgid "Restore Defaults" +msgstr "Remettre les valeurs par défaut" + +#: lib/option.tcl:99 +msgid "Save" +msgstr "Sauvegarder" + +#: lib/option.tcl:109 +#, tcl-format +msgid "%s Repository" - msgstr "Référentiel de %s" ++msgstr "Dépôt: %s" + +#: lib/option.tcl:110 +msgid "Global (All Repositories)" - msgstr "Globales (tous les référentiels)" ++msgstr "Globales (tous les dépôts)" + +#: lib/option.tcl:116 +msgid "User Name" +msgstr "Nom d'utilisateur" + +#: lib/option.tcl:117 +msgid "Email Address" +msgstr "Adresse email" + +#: lib/option.tcl:119 +msgid "Summarize Merge Commits" +msgstr "Résumer les commits de fusion" + +#: lib/option.tcl:120 +msgid "Merge Verbosity" +msgstr "Fusion bavarde" + +#: lib/option.tcl:121 +msgid "Show Diffstat After Merge" +msgstr "Montrer statistiques de diff après fusion" + +#: lib/option.tcl:123 +msgid "Trust File Modification Timestamps" +msgstr "Faire confiance aux dates de modification de fichiers " + +#: lib/option.tcl:124 +msgid "Prune Tracking Branches During Fetch" - msgstr "Nettoyer les branches de suivi pendant la récupération" ++msgstr "Purger les branches de suivi pendant la récupération" + +#: lib/option.tcl:125 +msgid "Match Tracking Branches" +msgstr "Faire correspondre les branches de suivi" + +#: lib/option.tcl:126 ++msgid "Blame Copy Only On Changed Files" ++msgstr "Annoter les copies seulement sur fichiers modifiés" ++ ++#: lib/option.tcl:127 ++msgid "Minimum Letters To Blame Copy On" ++msgstr "Minimum de caratères pour annoter une copie" ++ ++#: lib/option.tcl:128 +msgid "Number of Diff Context Lines" +msgstr "Nombre de lignes de contexte dans les diffs" + - #: lib/option.tcl:127 ++#: lib/option.tcl:129 +msgid "Commit Message Text Width" +msgstr "Largeur du texte de message de commit" + - #: lib/option.tcl:128 ++#: lib/option.tcl:130 +msgid "New Branch Name Template" +msgstr "Nouveau modèle de nom de branche" + - #: lib/option.tcl:192 ++#: lib/option.tcl:194 +msgid "Spelling Dictionary:" +msgstr "Dictionnaire d'orthographe :" + - #: lib/option.tcl:216 ++#: lib/option.tcl:218 +msgid "Change Font" - msgstr "Modifier les fontes" ++msgstr "Modifier les polices" + - #: lib/option.tcl:220 ++#: lib/option.tcl:222 +#, tcl-format +msgid "Choose %s" +msgstr "Choisir %s" + - #: lib/option.tcl:226 ++#: lib/option.tcl:228 +msgid "pt." +msgstr "pt." + - #: lib/option.tcl:240 ++#: lib/option.tcl:242 +msgid "Preferences" +msgstr "Préférences" + - #: lib/option.tcl:275 ++#: lib/option.tcl:277 +msgid "Failed to completely save options:" +msgstr "La sauvegarde complète des options a échouée :" + ++#: lib/remote.tcl:165 ++msgid "Prune from" ++msgstr "Purger de" ++ ++#: lib/remote.tcl:170 ++msgid "Fetch from" ++msgstr "Récupérer de" ++ ++#: lib/remote.tcl:213 ++msgid "Push to" ++msgstr "Pousser vers" ++ +#: lib/remote_branch_delete.tcl:29 lib/remote_branch_delete.tcl:34 +msgid "Delete Remote Branch" +msgstr "Supprimer branche distante" + +#: lib/remote_branch_delete.tcl:47 +msgid "From Repository" - msgstr "Référentiel" ++msgstr "Dépôt source" + +#: lib/remote_branch_delete.tcl:50 lib/transport.tcl:123 +msgid "Remote:" +msgstr "Branche distante :" + +#: lib/remote_branch_delete.tcl:66 lib/transport.tcl:138 +msgid "Arbitrary URL:" +msgstr "URL arbitraire :" + +#: lib/remote_branch_delete.tcl:84 +msgid "Branches" +msgstr "Branches" + +#: lib/remote_branch_delete.tcl:109 +msgid "Delete Only If" +msgstr "Supprimer seulement si" + +#: lib/remote_branch_delete.tcl:111 +msgid "Merged Into:" +msgstr "Fusionné dans :" + +#: lib/remote_branch_delete.tcl:119 +msgid "Always (Do not perform merge checks)" +msgstr "Toujours (ne pas vérifier les fusions)" + +#: lib/remote_branch_delete.tcl:152 +msgid "A branch is required for 'Merged Into'." +msgstr "Une branche est nécessaire pour 'Fusionné dans'." + +#: lib/remote_branch_delete.tcl:184 +#, tcl-format +msgid "" +"The following branches are not completely merged into %s:\n" +"\n" +" - %s" +msgstr "" +"Les branches suivantes ne sont pas complètement fusionnées dans %s :\n" +"\n" +" - %s" + +#: lib/remote_branch_delete.tcl:189 +#, tcl-format +msgid "" +"One or more of the merge tests failed because you have not fetched the " +"necessary commits. Try fetching from %s first." +msgstr "" +"Une ou plusieurs des tests de fusion ont échoués parce que vous n'avez pas " +"récupéré les commits nécessaires. Essayez de récupéré à partir de %s d'abord." + +#: lib/remote_branch_delete.tcl:207 +msgid "Please select one or more branches to delete." +msgstr "Merci de sélectionner une ou plusieurs branches à supprimer." + +#: lib/remote_branch_delete.tcl:216 +msgid "" +"Recovering deleted branches is difficult.\n" +"\n" +"Delete the selected branches?" +msgstr "" +"Récupérer des branches supprimées est difficile.\n" +"\n" +"Souhaitez vous supprimer les branches sélectionnées ?" + +#: lib/remote_branch_delete.tcl:226 +#, tcl-format +msgid "Deleting branches from %s" +msgstr "Supprimer les branches de %s" + +#: lib/remote_branch_delete.tcl:286 +msgid "No repository selected." - msgstr "Aucun référentiel n'est sélectionné." ++msgstr "Aucun dépôt n'est sélectionné." + +#: lib/remote_branch_delete.tcl:291 +#, tcl-format +msgid "Scanning %s..." +msgstr "Synchronisation de %s..." + - #: lib/remote.tcl:165 - msgid "Prune from" - msgstr "Nettoyer de" - - #: lib/remote.tcl:170 - msgid "Fetch from" - msgstr "Récupérer de" - - #: lib/remote.tcl:213 - msgid "Push to" - msgstr "Pousser vers" - +#: lib/shortcut.tcl:20 lib/shortcut.tcl:61 +msgid "Cannot write shortcut:" +msgstr "Impossible d'écrire le raccourcis :" + +#: lib/shortcut.tcl:136 +msgid "Cannot write icon:" +msgstr "Impossible d'écrire l'icône :" + +#: lib/spellcheck.tcl:57 +msgid "Unsupported spell checker" +msgstr "Vérificateur d'orthographe non supporté" + +#: lib/spellcheck.tcl:65 +msgid "Spell checking is unavailable" +msgstr "La vérification d'orthographe n'est pas disponible" + +#: lib/spellcheck.tcl:68 +msgid "Invalid spell checking configuration" +msgstr "Configuration de vérification d'orthographe invalide" + +#: lib/spellcheck.tcl:70 +#, tcl-format +msgid "Reverting dictionary to %s." +msgstr "Réinitialisation du dictionnaire à %s." + +#: lib/spellcheck.tcl:73 +msgid "Spell checker silently failed on startup" +msgstr "La vérification d'orthographe a échouée silentieusement au démarrage" + +#: lib/spellcheck.tcl:80 +msgid "Unrecognized spell checker" +msgstr "Vérificateur d'orthographe non reconnu" + - #: lib/spellcheck.tcl:180 ++#: lib/spellcheck.tcl:186 +msgid "No Suggestions" +msgstr "Aucune suggestion" + - #: lib/spellcheck.tcl:381 ++#: lib/spellcheck.tcl:387 +msgid "Unexpected EOF from spell checker" - msgstr "Fin de fichier innatendue envoyée par le vérificateur d'orthographe" ++msgstr "EOF inattendue envoyée par le vérificateur d'orthographe" + - #: lib/spellcheck.tcl:385 ++#: lib/spellcheck.tcl:391 +msgid "Spell Checker Failed" +msgstr "Le vérificateur d'orthographe a échoué" + +#: lib/status_bar.tcl:83 +#, tcl-format +msgid "%s ... %*i of %*i %s (%3i%%)" +msgstr "%s ... %*i de %*i %s (%3i%%)" + +#: lib/transport.tcl:6 +#, tcl-format +msgid "fetch %s" +msgstr "récupérer %s" + +#: lib/transport.tcl:7 +#, tcl-format +msgid "Fetching new changes from %s" +msgstr "Récupération des dernières modifications de %s" + +#: lib/transport.tcl:18 +#, tcl-format +msgid "remote prune %s" - msgstr "nettoyer à distance %s" ++msgstr "purger à distance %s" + +#: lib/transport.tcl:19 +#, tcl-format +msgid "Pruning tracking branches deleted from %s" +msgstr "Nettoyer les branches de suivi supprimées de %s" + +#: lib/transport.tcl:25 lib/transport.tcl:71 +#, tcl-format +msgid "push %s" +msgstr "pousser %s" + +#: lib/transport.tcl:26 +#, tcl-format +msgid "Pushing changes to %s" +msgstr "Les modifications sont poussées vers %s" + +#: lib/transport.tcl:72 +#, tcl-format +msgid "Pushing %s %s to %s" +msgstr "Pousse %s %s vers %s" + +#: lib/transport.tcl:89 +msgid "Push Branches" +msgstr "Pousser branches" + +#: lib/transport.tcl:103 +msgid "Source Branches" +msgstr "Branches source" + +#: lib/transport.tcl:120 +msgid "Destination Repository" - msgstr "Référentiel de destination" ++msgstr "Dépôt de destination" + +#: lib/transport.tcl:158 +msgid "Transfer Options" - msgstr "Transférer options" ++msgstr "Options de transfert" + +#: lib/transport.tcl:160 +msgid "Force overwrite existing branch (may discard changes)" +msgstr "" +"Forcer l'écrasement d'une branche existante (peut supprimer des " +"modifications)" + +#: lib/transport.tcl:164 +msgid "Use thin pack (for slow network connections)" +msgstr "Utiliser des petits paquets (pour les connexions lentes)" + +#: lib/transport.tcl:168 +msgid "Include tags" - msgstr "Inclure les marques" ++msgstr "Inclure les marques (tags)" + diff --cc git-gui/po/po2msg.sh index b7c4bf3fd,000000000..1e9f99252 mode 100644,000000..100644 --- a/git-gui/po/po2msg.sh +++ b/git-gui/po/po2msg.sh @@@ -1,152 -1,0 +1,152 @@@ +#!/bin/sh +# Tcl ignores the next line -*- tcl -*- \ +exec tclsh "$0" -- "$@" + +# This is a really stupid program, which serves as an alternative to +# msgfmt. It _only_ translates to Tcl mode, does _not_ validate the +# input, and does _not_ output any statistics. + +proc u2a {s} { + set res "" + foreach i [split $s ""] { + scan $i %c c + if {$c<128} { - # escape '[', '\' and ']' - if {$c == 0x5b || $c == 0x5d} { ++ # escape '[', '\', '$' and ']' ++ if {$c == 0x5b || $c == 0x5d || $c == 0x24} { + append res "\\" + } + append res $i + } else { + append res \\u[format %04.4x $c] + } + } + return $res +} + +set output_directory "." +set lang "dummy" +set files [list] +set show_statistics 0 + +# parse options +for {set i 0} {$i < $argc} {incr i} { + set arg [lindex $argv $i] + if {$arg == "--statistics"} { + incr show_statistics + continue + } + if {$arg == "--tcl"} { + # we know + continue + } + if {$arg == "-l"} { + incr i + set lang [lindex $argv $i] + continue + } + if {$arg == "-d"} { + incr i + set tmp [lindex $argv $i] + regsub "\[^/\]$" $tmp "&/" output_directory + continue + } + lappend files $arg +} + +proc flush_msg {} { + global msgid msgstr mode lang out fuzzy + global translated_count fuzzy_count not_translated_count + + if {![info exists msgid] || $mode == ""} { + return + } + set mode "" + if {$fuzzy == 1} { + incr fuzzy_count + set fuzzy 0 + return + } + + if {$msgid == ""} { + set prefix "set ::msgcat::header" + } else { + if {$msgstr == ""} { + incr not_translated_count + return + } + set prefix "::msgcat::mcset $lang \"[u2a $msgid]\"" + incr translated_count + } + + puts $out "$prefix \"[u2a $msgstr]\"" +} + +set fuzzy 0 +set translated_count 0 +set fuzzy_count 0 +set not_translated_count 0 +foreach file $files { + regsub "^.*/\(\[^/\]*\)\.po$" $file "$output_directory\\1.msg" outfile + set in [open $file "r"] + fconfigure $in -encoding utf-8 + set out [open $outfile "w"] + + set mode "" + while {[gets $in line] >= 0} { + if {[regexp "^#" $line]} { + if {[regexp ", fuzzy" $line]} { + set fuzzy 1 + } else { + flush_msg + } + continue + } elseif {[regexp "^msgid \"(.*)\"$" $line dummy match]} { + flush_msg + set msgid $match + set mode "msgid" + } elseif {[regexp "^msgstr \"(.*)\"$" $line dummy match]} { + set msgstr $match + set mode "msgstr" + } elseif {$line == ""} { + flush_msg + } elseif {[regexp "^\"(.*)\"$" $line dummy match]} { + if {$mode == "msgid"} { + append msgid $match + } elseif {$mode == "msgstr"} { + append msgstr $match + } else { + puts stderr "I do not know what to do: $match" + } + } else { + puts stderr "Cannot handle $line" + } + } + flush_msg + close $in + close $out +} + +if {$show_statistics} { + set str "" + + append str "$translated_count translated message" + if {$translated_count != 1} { + append str s + } + + if {$fuzzy_count > 1} { + append str ", $fuzzy_count fuzzy translation" + if {$fuzzy_count != 1} { + append str s + } + } + if {$not_translated_count > 0} { + append str ", $not_translated_count untranslated message" + if {$not_translated_count != 1} { + append str s + } + } + + append str . + puts $str +}