From 9712b81a765978d2770b32bb77d25bfbf05d5eb5 Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Sat, 6 Dec 2008 21:44:05 +1100 Subject: gitk: Fix bugs in blaming code The "show origin of this line" function wasn't working when gitk was run in a subdirectory, since it passed the path relative to the top-level directory to git blame. This fixes it by passing the absolute path to the file instead of the relative path. The same problem occurs when running git gui blame, except that git gui blame appears not to be able to accept an absolute path to the file, so we make a relative path using a new [make_relative] function. Finally, this fixes a bug in [show_line_source] where we weren't setting id, resulting in an error when trying to find the origin of a line in the fake commit for local changes not checked in, when its parent was a real commit (i.e. there were no changes checked in). Signed-off-by: Paul Mackerras diff --git a/gitk b/gitk index 64a873d..a5e24e4 100755 --- a/gitk +++ b/gitk @@ -3318,8 +3318,27 @@ proc index_sha1 {fname} { return {} } +# Turn an absolute path into one relative to the current directory +proc make_relative {f} { + set elts [file split $f] + set here [file split [pwd]] + set ei 0 + set hi 0 + set res {} + foreach d $here { + if {$ei < $hi || $ei >= [llength $elts] || [lindex $elts $ei] ne $d} { + lappend res ".." + } else { + incr ei + } + incr hi + } + set elts [concat $res [lrange $elts $ei end]] + return [eval file join $elts] +} + proc external_blame {parent_idx {line {}}} { - global flist_menu_file + global flist_menu_file gitdir global nullid nullid2 global parentlist selectedline currentid @@ -3338,7 +3357,12 @@ proc external_blame {parent_idx {line {}}} { if {$line ne {} && $line > 1} { lappend cmdline "--line=$line" } - lappend cmdline $base_commit $flist_menu_file + set f [file join [file dirname $gitdir] $flist_menu_file] + # Unfortunately it seems git gui blame doesn't like + # being given an absolute path... + set f [make_relative $f] + lappend cmdline $base_commit $f + puts "cmdline={$cmdline}" if {[catch {eval exec $cmdline &} err]} { error_popup "[mc "git gui blame: command failed:"] $err" } @@ -3382,6 +3406,8 @@ proc show_line_source {} { error_popup [mc "Error reading index: %s" $err] return } + } else { + set id $parents($curview,$currentid) } } else { set id [lindex $parents($curview,$currentid) $pi] @@ -3398,7 +3424,7 @@ proc show_line_source {} { } else { lappend blameargs $id } - lappend blameargs -- $flist_menu_file + lappend blameargs -- [file join [file dirname $gitdir] $flist_menu_file] if {[catch { set f [open $blameargs r] } err]} { -- cgit v0.10.2-6-g49f6 From 97bed03448d864f38fac34eacf2fa124df526788 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Tue, 2 Dec 2008 02:19:22 +0100 Subject: gitk: Map / to focus the search box The / key is often used to initiate searches (less, vim, some web browsers). This changes the binding for the / (slash) key from 'find next' to 'focus the search box' to follow this convention. Signed-off-by: Giuseppe Bilotta Signed-off-by: Paul Mackerras diff --git a/gitk b/gitk index a5e24e4..738f3bd 100755 --- a/gitk +++ b/gitk @@ -2279,7 +2279,7 @@ proc makewindow {} { bindkey b prevfile bindkey d "$ctext yview scroll 18 units" bindkey u "$ctext yview scroll -18 units" - bindkey / {dofind 1 1} + bindkey / {focus $fstring} bindkey {dofind 1 1} bindkey ? {dofind -1 1} bindkey f nextfile @@ -2660,7 +2660,7 @@ proc keys {} { [mc "<%s-F> Find" $M1T] [mc "<%s-G> Move to next find hit" $M1T] [mc " Move to next find hit"] -[mc "/ Move to next find hit, or redo find"] +[mc "/ Focus the search box"] [mc "? Move to previous find hit"] [mc "f Scroll diff view to next file"] [mc "<%s-S> Search for next hit in diff view" $M1T] -- cgit v0.10.2-6-g49f6 From adcbec13b9bbcb5e4a15de403038ff91d55b7ece Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Tue, 2 Dec 2008 21:42:16 +0100 Subject: gitk: Use check-buttons' -text property instead of separate labels Previously the check-buttons' labels in the Preferences were separate widgets. This had the disadvantage that in order to toggle the check-button with the mouse the check-box had to be clicked. With this change the check-box can also be toggled by clicking the label. Signed-off-by: Johannes Sixt Signed-off-by: Paul Mackerras diff --git a/gitk b/gitk index 738f3bd..acda295 100755 --- a/gitk +++ b/gitk @@ -10105,15 +10105,11 @@ proc doprefs {} { -font optionfont spinbox $top.maxpct -from 1 -to 100 -width 4 -textvariable maxgraphpct grid x $top.maxpctl $top.maxpct -sticky w - frame $top.showlocal - label $top.showlocal.l -text [mc "Show local changes"] -font optionfont - checkbutton $top.showlocal.b -variable showlocalchanges - pack $top.showlocal.b $top.showlocal.l -side left + checkbutton $top.showlocal -text [mc "Show local changes"] \ + -font optionfont -variable showlocalchanges grid x $top.showlocal -sticky w - frame $top.autoselect - label $top.autoselect.l -text [mc "Auto-select SHA1"] -font optionfont - checkbutton $top.autoselect.b -variable autoselect - pack $top.autoselect.b $top.autoselect.l -side left + checkbutton $top.autoselect -text [mc "Auto-select SHA1"] \ + -font optionfont -variable autoselect grid x $top.autoselect -sticky w label $top.ddisp -text [mc "Diff display options"] @@ -10121,20 +10117,14 @@ proc doprefs {} { label $top.tabstopl -text [mc "Tab spacing"] -font optionfont spinbox $top.tabstop -from 1 -to 20 -width 4 -textvariable tabstop grid x $top.tabstopl $top.tabstop -sticky w - frame $top.ntag - label $top.ntag.l -text [mc "Display nearby tags"] -font optionfont - checkbutton $top.ntag.b -variable showneartags - pack $top.ntag.b $top.ntag.l -side left + checkbutton $top.ntag -text [mc "Display nearby tags"] \ + -font optionfont -variable showneartags grid x $top.ntag -sticky w - frame $top.ldiff - label $top.ldiff.l -text [mc "Limit diffs to listed paths"] -font optionfont - checkbutton $top.ldiff.b -variable limitdiffs - pack $top.ldiff.b $top.ldiff.l -side left + checkbutton $top.ldiff -text [mc "Limit diffs to listed paths"] \ + -font optionfont -variable limitdiffs grid x $top.ldiff -sticky w - frame $top.lattr - label $top.lattr.l -text [mc "Support per-file encodings"] -font optionfont - checkbutton $top.lattr.b -variable perfile_attrs - pack $top.lattr.b $top.lattr.l -side left + checkbutton $top.lattr -text [mc "Support per-file encodings"] \ + -font optionfont -variable perfile_attrs grid x $top.lattr -sticky w entry $top.extdifft -textvariable extdifftool -- cgit v0.10.2-6-g49f6 From da12e59dd6732f2f6dfe6285193dbebe9cd5a91b Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Wed, 3 Dec 2008 13:43:20 +0100 Subject: gitk: Ensure that "Reset branch" menu entry is enabled Consider this sequence of events: 1. Detach HEAD and fire up gitk 2. Call the context menu on some commit. Notice that the last menu entry says "Detached HEAD: can't reset" and it is disabled. 3. Now checkout some regular branch (e.g. 'master') using the context menu. 4. Call the context menu again on some commit. Previously, at this point the last menu entry said "Reset master branch to here", but it was still disabled. With this fix it is now enabled again. Signed-off-by: Johannes Sixt Signed-off-by: Paul Mackerras diff --git a/gitk b/gitk index acda295..2feb667 100755 --- a/gitk +++ b/gitk @@ -7979,7 +7979,7 @@ proc rowmenu {x y id} { if {$id ne $nullid && $id ne $nullid2} { set menu $rowctxmenu if {$mainhead ne {}} { - $menu entryconfigure 7 -label [mc "Reset %s branch to here" $mainhead] + $menu entryconfigure 7 -label [mc "Reset %s branch to here" $mainhead] -state normal } else { $menu entryconfigure 7 -label [mc "Detached head: can't reset" $mainhead] -state disabled } -- cgit v0.10.2-6-g49f6 From 968b016a4a910f5f52149831a5d480851e789bc3 Mon Sep 17 00:00:00 2001 From: Christian Stimming Date: Sat, 6 Dec 2008 20:48:30 +0100 Subject: gitk: Mark forgotten strings (header sentence parts in color chooser) for translation Signed-off-by: Paul Mackerras diff --git a/gitk b/gitk index 2feb667..6d9e528 100755 --- a/gitk +++ b/gitk @@ -10140,26 +10140,26 @@ proc doprefs {} { grid $top.cdisp - -sticky w -pady 10 label $top.bg -padx 40 -relief sunk -background $bgcolor button $top.bgbut -text [mc "Background"] -font optionfont \ - -command [list choosecolor bgcolor {} $top.bg background setbg] + -command [list choosecolor bgcolor {} $top.bg [mc "background"] setbg] grid x $top.bgbut $top.bg -sticky w label $top.fg -padx 40 -relief sunk -background $fgcolor button $top.fgbut -text [mc "Foreground"] -font optionfont \ - -command [list choosecolor fgcolor {} $top.fg foreground setfg] + -command [list choosecolor fgcolor {} $top.fg [mc "foreground"] setfg] grid x $top.fgbut $top.fg -sticky w label $top.diffold -padx 40 -relief sunk -background [lindex $diffcolors 0] button $top.diffoldbut -text [mc "Diff: old lines"] -font optionfont \ - -command [list choosecolor diffcolors 0 $top.diffold "diff old lines" \ + -command [list choosecolor diffcolors 0 $top.diffold [mc "diff old lines"] \ [list $ctext tag conf d0 -foreground]] grid x $top.diffoldbut $top.diffold -sticky w label $top.diffnew -padx 40 -relief sunk -background [lindex $diffcolors 1] button $top.diffnewbut -text [mc "Diff: new lines"] -font optionfont \ - -command [list choosecolor diffcolors 1 $top.diffnew "diff new lines" \ + -command [list choosecolor diffcolors 1 $top.diffnew [mc "diff new lines"] \ [list $ctext tag conf dresult -foreground]] grid x $top.diffnewbut $top.diffnew -sticky w label $top.hunksep -padx 40 -relief sunk -background [lindex $diffcolors 2] button $top.hunksepbut -text [mc "Diff: hunk header"] -font optionfont \ -command [list choosecolor diffcolors 2 $top.hunksep \ - "diff hunk header" \ + [mc "diff hunk header"] \ [list $ctext tag conf hunksep -foreground]] grid x $top.hunksepbut $top.hunksep -sticky w label $top.markbgsep -padx 40 -relief sunk -background $markbgcolor @@ -10170,7 +10170,7 @@ proc doprefs {} { grid x $top.markbgbut $top.markbgsep -sticky w label $top.selbgsep -padx 40 -relief sunk -background $selectbgcolor button $top.selbgbut -text [mc "Select bg"] -font optionfont \ - -command [list choosecolor selectbgcolor {} $top.selbgsep background setselbg] + -command [list choosecolor selectbgcolor {} $top.selbgsep [mc "background"] setselbg] grid x $top.selbgbut $top.selbgsep -sticky w label $top.cfont -text [mc "Fonts: press to choose"] -- cgit v0.10.2-6-g49f6 From 48027a918d89bad6735897a2c3da77c0451a038c Mon Sep 17 00:00:00 2001 From: Christian Stimming Date: Sat, 6 Dec 2008 20:49:24 +0100 Subject: gitk: Update German translation Attached to avoid whitespace problems. Regards, Christian From 282060ac531fee722142f9d39c4ff29570723cbb Mon Sep 17 00:00:00 2001 From: Christian Stimming Date: Sat, 6 Dec 2008 20:47:15 +0100 Subject: [PATCH 2/2] gitk: Update German translation Merged with most recent "make update-po" result. Signed-off-by: Christian Stimming Signed-off-by: Paul Mackerras diff --git a/po/de.po b/po/de.po index e0a6dee..825dc98 100644 --- a/po/de.po +++ b/po/de.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: git-gui\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-10-25 13:18+0200\n" -"PO-Revision-Date: 2008-10-25 13:23+0200\n" +"POT-Creation-Date: 2008-12-06 20:40+0100\n" +"PO-Revision-Date: 2008-12-06 20:45+0100\n" "Last-Translator: Christian Stimming \n" "Language-Team: German\n" "MIME-Version: 1.0\n" @@ -90,7 +90,11 @@ msgstr "Zweige neu laden" msgid "List references" msgstr "Zweige/Markierungen auflisten" -#: gitk:1815 +#: gitk:1915 +msgid "Start git gui" +msgstr "»git gui« starten" + +#: gitk:1917 msgid "Quit" msgstr "Beenden" @@ -295,7 +299,15 @@ msgstr "Externer Vergleich" msgid "Blame parent commit" msgstr "Annotieren der Elternversion" -#: gitk:2488 +#: gitk:2360 +msgid "Show origin of this line" +msgstr "Herkunft dieser Zeile anzeigen" + +#: gitk:2361 +msgid "Run git gui blame on this line" +msgstr "Annotieren (»git gui blame«) von dieser Zeile" + +#: gitk:2606 msgid "" "\n" "Gitk - a commit viewer for git\n" @@ -501,7 +513,38 @@ msgstr "Version nicht gefunden" msgid "git gui blame: command failed:" msgstr "git gui blame: Kommando fehlgeschlagen:" -#: gitk:3092 +#: gitk:3398 +#, tcl-format +msgid "Couldn't read merge head: %s" +msgstr "Zusammenführungs-Spitze konnte nicht gelesen werden: %s" + +#: gitk:3406 +#, tcl-format +msgid "Error reading index: %s" +msgstr "Fehler beim Lesen der Bereitstellung (»index«): %s" + +#: gitk:3431 +#, tcl-format +msgid "Couldn't start git blame: %s" +msgstr "»git blame« konnte nicht gestartet werden: %s" + +#: gitk:3434 gitk:6160 +msgid "Searching" +msgstr "Suchen" + +#: gitk:3466 +#, tcl-format +msgid "Error running git blame: %s" +msgstr "Fehler beim Ausführen von »git blame«: %s" + +#: gitk:3494 +#, tcl-format +msgid "That line comes from commit %s, which is not in this view" +msgstr "" +"Diese Zeile stammt aus Version %s, welche nicht in dieser Ansicht gezeigt " +"wird." + +#: gitk:3508 msgid "External diff viewer failed:" msgstr "Externes Vergleich-(Diff-)Programm fehlgeschlagen:" @@ -509,11 +552,7 @@ msgstr "Externes Vergleich-(Diff-)Programm fehlgeschlagen:" msgid "Gitk view definition" msgstr "Gitk Ansichten" -#: gitk:3225 -msgid "Name" -msgstr "Name" - -#: gitk:3228 +#: gitk:3630 msgid "Remember this view" msgstr "Diese Ansicht speichern" @@ -521,15 +560,55 @@ msgstr "Diese Ansicht speichern" msgid "Commits to include (arguments to git log):" msgstr "Versionen anzeigen (Argumente von git-log):" -#: gitk:3239 +#: gitk:3632 +msgid "Use all refs" +msgstr "Alle Zweige verwenden" + +#: gitk:3633 +msgid "Strictly sort by date" +msgstr "Streng nach Datum sortieren" + +#: gitk:3634 +msgid "Mark branch sides" +msgstr "Zweig-Seiten markieren" + +#: gitk:3635 +msgid "Since date:" +msgstr "Von Datum:" + +#: gitk:3636 +msgid "Until date:" +msgstr "Bis Datum:" + +#: gitk:3637 +msgid "Max count:" +msgstr "Max. Anzahl:" + +#: gitk:3638 +msgid "Skip:" +msgstr "Überspringen:" + +#: gitk:3639 +msgid "Limit to first parent" +msgstr "Auf erste Elternversion beschränken" + +#: gitk:3640 msgid "Command to generate more commits to include:" msgstr "Versionsliste durch folgendes Kommando erzeugen lassen:" -#: gitk:3246 +#: gitk:3749 +msgid "Name" +msgstr "Name" + +#: gitk:3797 msgid "Enter files and directories to include, one per line:" msgstr "Folgende Dateien und Verzeichnisse anzeigen (eine pro Zeile):" -#: gitk:3293 +#: gitk:3811 +msgid "Apply (F5)" +msgstr "Anwenden (F5)" + +#: gitk:3849 msgid "Error in commit selection arguments:" msgstr "Fehler in den ausgewählten Versionen:" @@ -569,11 +648,7 @@ msgstr "Lokale Änderungen bereitgestellt, aber nicht eingetragen" msgid "Local uncommitted changes, not checked in to index" msgstr "Lokale Änderungen, nicht bereitgestellt" -#: gitk:5549 -msgid "Searching" -msgstr "Suchen" - -#: gitk:6049 +#: gitk:6673 msgid "Tags:" msgstr "Markierungen:" @@ -597,11 +672,12 @@ msgstr "Folgt auf" msgid "Precedes" msgstr "Vorgänger von" -#: gitk:6378 -msgid "Error getting merge diffs:" -msgstr "Fehler beim Laden des Vergleichs:" +#: gitk:7209 +#, tcl-format +msgid "Error getting diffs: %s" +msgstr "Fehler beim Laden des Vergleichs: %s" -#: gitk:7113 +#: gitk:7748 msgid "Goto:" msgstr "Gehe zu:" @@ -722,7 +798,12 @@ msgstr "Name:" msgid "Please specify a name for the new branch" msgstr "Bitte geben Sie einen Namen für den neuen Zweig an." -#: gitk:7703 +#: gitk:8328 +#, tcl-format +msgid "Branch '%s' already exists. Overwrite?" +msgstr "Zweig »%s« existiert bereits. Soll er überschrieben werden?" + +#: gitk:8394 #, tcl-format msgid "Commit %s is already included in branch %s -- really re-apply it?" msgstr "" @@ -733,7 +814,26 @@ msgstr "" msgid "Cherry-picking" msgstr "Version pflücken" -#: gitk:7720 +#: gitk:8408 +#, tcl-format +msgid "" +"Cherry-pick failed because of local changes to file '%s'.\n" +"Please commit, reset or stash your changes and try again." +msgstr "" +"Pflücken fehlgeschlagen, da noch lokale Änderungen in Datei »%s«\n" +"vorliegen. Bitte diese Änderungen eintragen, zurücksetzen oder\n" +"zwischenspeichern (»git stash») und dann erneut versuchen." + +#: gitk:8414 +msgid "" +"Cherry-pick failed because of merge conflict.\n" +"Do you wish to run git citool to resolve it?" +msgstr "" +"Pflücken fehlgeschlagen, da ein Zusammenführungs-Konflikt aufgetreten\n" +"ist. Soll das »git citool« (Zusammenführungs-Werkzeug) aufgerufen\n" +"werden, um diesen Konflikt aufzulösen?" + +#: gitk:8430 msgid "No changes committed" msgstr "Keine Änderungen eingetragen" @@ -889,23 +989,51 @@ msgstr "Farben: Klicken zum Wählen" msgid "Background" msgstr "Hintergrund" -#: gitk:9435 +#: gitk:10153 gitk:10183 +msgid "background" +msgstr "Hintergrund" + +#: gitk:10156 msgid "Foreground" msgstr "Vordergrund" -#: gitk:9439 +#: gitk:10157 +msgid "foreground" +msgstr "Vordergrund" + +#: gitk:10160 msgid "Diff: old lines" msgstr "Vergleich: Alte Zeilen" -#: gitk:9444 +#: gitk:10161 +msgid "diff old lines" +msgstr "Vergleich - Alte Zeilen" + +#: gitk:10165 msgid "Diff: new lines" msgstr "Vergleich: Neue Zeilen" -#: gitk:9449 +#: gitk:10166 +msgid "diff new lines" +msgstr "Vergleich - Neue Zeilen" + +#: gitk:10170 msgid "Diff: hunk header" msgstr "Vergleich: Änderungstitel" -#: gitk:9455 +#: gitk:10172 +msgid "diff hunk header" +msgstr "Vergleich - Änderungstitel" + +#: gitk:10176 +msgid "Marked line bg" +msgstr "Markierte Zeile Hintergrund" + +#: gitk:10178 +msgid "marked line background" +msgstr "markierte Zeile Hintergrund" + +#: gitk:10182 msgid "Select bg" msgstr "Hintergrundfarbe Auswählen" -- cgit v0.10.2-6-g49f6 From 61f57cb07d88e06a2027a4a4c571c59d353361a5 Mon Sep 17 00:00:00 2001 From: Kevin Ballard Date: Thu, 18 Dec 2008 01:26:48 -0800 Subject: gitk: Allow unbalanced quotes/braces in commit headers When parsing commits, gitk treats the headers of the commit as tcl lists. This causes errors if the header contains an unbalanced quote or open brace. Splitting the line on spaces allows us to treat it as a set of words instead of as a tcl list, which prevents errors. Signed-off-by: Kevin Ballard Signed-off-by: Paul Mackerras diff --git a/gitk b/gitk index 6d9e528..d721969 100755 --- a/gitk +++ b/gitk @@ -1601,13 +1601,14 @@ proc parsecommit {id contents listed} { set header [string range $contents 0 [expr {$hdrend - 1}]] set comment [string range $contents [expr {$hdrend + 2}] end] foreach line [split $header "\n"] { + set line [split $line " "] set tag [lindex $line 0] if {$tag == "author"} { set audate [lindex $line end-1] - set auname [lrange $line 1 end-2] + set auname [join [lrange $line 1 end-2] " "] } elseif {$tag == "committer"} { set comdate [lindex $line end-1] - set comname [lrange $line 1 end-2] + set comname [join [lrange $line 1 end-2] " "] } } set headline {} -- cgit v0.10.2-6-g49f6 From e4df519f05ab20eae235968166a17a5a196bc377 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Thu, 18 Dec 2008 08:30:49 +0100 Subject: gitk: Force the focus to the main window on Windows On msysGit, the focus is first on the (Tk) console. This console is then hidden, but keeps the focus. Work around that by forcing the focus onto the gitk window. This fixes msysGit issue 14. Diagnosed and originally fixed by Johannes Schindelin. Signed-off-by: Johannes Sixt Signed-off-by: Paul Mackerras diff --git a/gitk b/gitk index d721969..dc2a439 100755 --- a/gitk +++ b/gitk @@ -10914,4 +10914,9 @@ if {[info exists permviews]} { addviewmenu $n } } + +if {[tk windowingsystem] eq "win32"} { + focus -force . +} + getcommits {} -- cgit v0.10.2-6-g49f6