From 1cac41f8eaf00e3e8837bf8aab12fc317a5b8a21 Mon Sep 17 00:00:00 2001 From: Christoffer Pettersson Date: Mon, 16 May 2011 10:36:00 +0100 Subject: [PATCH 01/13] git-gui: Corrected a typo in the Swedish translation of 'Continue' Reported-by: Christoffer Pettersson Signed-off-by: Pat Thoyts --- po/sv.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/po/sv.po b/po/sv.po index 8bd3c5d75f..24cc4e3675 100644 --- a/po/sv.po +++ b/po/sv.po @@ -1714,7 +1714,7 @@ msgstr "" #: lib/index.tcl:30 msgid "Continue" -msgstr "Forstätt" +msgstr "Fortsätt" #: lib/index.tcl:33 msgid "Unlock Index" From e34789cc8ba45d5491c007274b41849d3b0b84b7 Mon Sep 17 00:00:00 2001 From: Heiko Voigt Date: Tue, 15 Feb 2011 19:43:54 +0000 Subject: [PATCH 02/13] git-gui: warn when trying to commit on a detached head The commandline is already warning when checking out a detached head. Since the only thing thats potentially dangerous is to create commits on a detached head lets warn in case the user is about to do that. Signed-off-by: Heiko Voigt Signed-off-by: Pat Thoyts --- git-gui.sh | 1 + lib/commit.tcl | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/git-gui.sh b/git-gui.sh index fd6a43d0a2..470b135285 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -854,6 +854,7 @@ set default_config(gui.fontdiff) [font configure font_diff] # TODO: this option should be added to the git-config documentation set default_config(gui.maxfilesdisplayed) 5000 set default_config(gui.usettk) 1 +set default_config(gui.warndetachedcommit) 1 set font_descs { {fontui font_ui {mc "Main Font"}} {fontdiff font_diff {mc "Diff/Console Font"}} diff --git a/lib/commit.tcl b/lib/commit.tcl index 5ce46877bf..372bed9948 100644 --- a/lib/commit.tcl +++ b/lib/commit.tcl @@ -260,8 +260,23 @@ proc commit_prehook_wait {fd_ph curHEAD msg_p} { } proc commit_commitmsg {curHEAD msg_p} { + global is_detached repo_config global pch_error + if {$is_detached && $repo_config(gui.warndetachedcommit)} { + set msg [mc "You are about to commit on a detached head.\ +This is a potentially dangerous thing to do because if you switch\ +to another branch you will loose your changes and it can be difficult\ +to retrieve them later from the reflog. You should probably cancel this\ +commit and create a new branch to continue.\n\ +\n\ +Do you really want to proceed with your Commit?"] + if {[ask_popup $msg] ne yes} { + unlock_index + return + } + } + # -- Run the commit-msg hook. # set fd_ph [githook_read commit-msg $msg_p] From 8c0bf68353ed3394039ca04c01ded39a4f5643ea Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Thu, 31 Mar 2011 16:24:36 +0100 Subject: [PATCH 03/13] git-gui: updated translator README for current procedures. We do not have a mob branch and the i18n fork is no longer used. Suggest translators simply send patches as per other contributors. Reported-by: Rodrigo Rosenfeld Signed-off-by: Pat Thoyts --- po/README | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/po/README b/po/README index 595bbf5dee..0f5837d48e 100644 --- a/po/README +++ b/po/README @@ -18,28 +18,23 @@ specialized so-called "po file editors" (e.g. emacs po-mode, KBabel, poedit, GTranslator --- any of them would work well). Please install them. -You would then need to clone the git-gui internationalization project -repository, so that you can work on it: +You would then need to clone the git-gui project repository and create +a feature branch to begin working: - $ git clone mob@repo.or.cz:/srv/git/git-gui/git-gui-i18n.git/ - $ cd git-gui-i18n - $ git checkout --track -b mob origin/mob - $ git config remote.origin.push mob + $ git clone git://repo.or.cz/git-gui.git + $ cd git-gui.git + $ git checkout -b my-translation -The "git checkout" command creates a 'mob' branch from upstream's -corresponding branch and makes it your current branch. You will be -working on this branch. - -The "git config" command records in your repository configuration file -that you would push "mob" branch to the upstream when you say "git -push". +The "git checkout" command creates a new branch to keep your work +isolated and to make it simple to post your patch series when +completed. You will be working on this branch. 2. Starting a new language. -In the git-gui-i18n directory is a po/ subdirectory. It has a -handful files whose names end with ".po". Is there a file that has -messages in your language? +In the git-gui directory is a po/ subdirectory. It has a handful of +files whose names end with ".po". Is there a file that has messages +in your language? If you do not know what your language should be named, you need to find it. This currently follows ISO 639-1 two letter codes: @@ -149,15 +144,18 @@ There is a trick to test your translation without first installing: $ make $ LANG=af ./git-gui.sh -When you are satisfied with your translation, commit your changes, and -push it back to the 'mob' branch: +When you are satisfied with your translation, commit your changes then submit +your patch series to the maintainer and the Git mailing list: $ edit po/af.po ... be sure to update Last-Translator: and ... PO-Revision-Date: lines. $ git add po/af.po - $ git commit -m 'Started Afrikaans translation.' - $ git push + $ git commit -s -m 'git-gui: added Afrikaans translation.' + $ git send-email --to 'git@vger.kernel.org' \ + --cc 'Pat Thoyts ' \ + --subject 'git-gui: Afrikaans translation' \ + master.. 3. Updating your translation. @@ -169,6 +167,7 @@ itself was updated and there are new messages that need translation. In any case, make sure you are up-to-date before starting your work: + $ git checkout master $ git pull In the former case, you will edit po/af.po (again, replace "af" with From c5c45e1a2ddc28101ad19615ef6f9e0e08822206 Mon Sep 17 00:00:00 2001 From: Dmitry Ivankov Date: Thu, 16 Jun 2011 18:22:39 +0600 Subject: [PATCH 04/13] Fix typo: existant->existent This typo was discovered in core git sources. Clean in it up in git-gui too. There is just one occurence in a comment line. Signed-off-by: Dmitry Ivankov Signed-off-by: Pat Thoyts --- git-gui.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-gui.sh b/git-gui.sh index 470b135285..f8971603f7 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -1527,7 +1527,7 @@ proc run_prepare_commit_msg_hook {} { # prepare-commit-msg requires PREPARE_COMMIT_MSG exist. From git-gui # it will be .git/MERGE_MSG (merge), .git/SQUASH_MSG (squash), or an - # empty file but existant file. + # empty file but existent file. set fd_pcm [open [gitdir PREPARE_COMMIT_MSG] a] From 768e300a508d0e9e685929082a99c885ff384ffc Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Mon, 11 Jul 2011 13:55:38 +0100 Subject: [PATCH 05/13] Fix tooltip display with multiple monitors on windows. On Windows the position of a window may be negative on a monitor to the left of the primary display. A plus sign is used as the separator between the width and height and the positional parts of the geometry so always include the plus sign even for negative positions on this platform. Signed-off-by: Pat Thoyts --- lib/blame.tcl | 4 ++-- lib/choose_rev.tcl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/blame.tcl b/lib/blame.tcl index 61e358f960..1f2977d5bb 100644 --- a/lib/blame.tcl +++ b/lib/blame.tcl @@ -1298,9 +1298,9 @@ method _position_tooltip {} { set pos_y [expr {[winfo pointery .] + 10}] set g "${req_w}x${req_h}" - if {$pos_x >= 0} {append g +} + if {[tk windowingsystem] eq "win32" || $pos_x >= 0} {append g +} append g $pos_x - if {$pos_y >= 0} {append g +} + if {[tk windowingsystem] eq "win32" || $pos_y >= 0} {append g +} append g $pos_y wm geometry $tooltip_wm $g diff --git a/lib/choose_rev.tcl b/lib/choose_rev.tcl index c12d5e1698..54c7957a66 100644 --- a/lib/choose_rev.tcl +++ b/lib/choose_rev.tcl @@ -610,9 +610,9 @@ method _position_tooltip {} { set pos_y [expr {[winfo pointery .] + 10}] set g "${req_w}x${req_h}" - if {$pos_x >= 0} {append g +} + if {[tk windowingsystem] eq "win32" || $pos_x >= 0} {append g +} append g $pos_x - if {$pos_y >= 0} {append g +} + if {[tk windowingsystem] eq "win32" || $pos_y >= 0} {append g +} append g $pos_y wm geometry $tooltip_wm $g From 9a483e5c093bc5fa364e02b7a4aeb26dde99a5e9 Mon Sep 17 00:00:00 2001 From: David Fries Date: Sat, 16 Jul 2011 20:47:14 -0500 Subject: [PATCH 06/13] git-gui: Enable jumping to a specific line number in blame view. This patch adds a goto control similar to the search control currently available. The goto control permits the user to specify a line number to jump to. When in blame, Control-G is bound to display this control. Signed-off-by: David Fries Signed-off-by: Pat Thoyts --- lib/blame.tcl | 11 +++++++++ lib/line.tcl | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 lib/line.tcl diff --git a/lib/blame.tcl b/lib/blame.tcl index 1f2977d5bb..14fde81761 100644 --- a/lib/blame.tcl +++ b/lib/blame.tcl @@ -22,6 +22,7 @@ field w_asim ; # text column: annotations (simple computation) field w_file ; # text column: actual file data field w_cviewer ; # pane showing commit message field finder ; # find mini-dialog frame +field gotoline ; # line goto mini-dialog frame field status ; # status mega-widget instance field old_height ; # last known height of $w.file_pane @@ -231,6 +232,11 @@ constructor new {i_commit i_path i_jump} { -column [expr {[llength $w_columns] - 1}] \ ] + set gotoline [::linebar::new \ + $w.file_pane.out.lf $w_file \ + -column [expr {[llength $w_columns] - 1}] \ + ] + set w_cviewer $w.file_pane.cm.t text $w_cviewer \ -background white \ @@ -275,6 +281,10 @@ constructor new {i_commit i_path i_jump} { -label [mc "Find Text..."] \ -accelerator F7 \ -command [list searchbar::show $finder] + $w.ctxm add command \ + -label [mc "Goto Line..."] \ + -accelerator "Ctrl-G" \ + -command [list linebar::show $gotoline] menu $w.ctxm.enc build_encoding_menu $w.ctxm.enc [cb _setencoding] $w.ctxm add cascade \ @@ -345,6 +355,7 @@ constructor new {i_commit i_path i_jump} { bind $top [list searchbar::hide $finder] bind $top [list searchbar::find_next $finder] bind $top [list searchbar::find_prev $finder] + bind $top [list linebar::show $gotoline] catch { bind $top [list searchbar::find_prev $finder] } grid configure $w.header -sticky ew diff --git a/lib/line.tcl b/lib/line.tcl new file mode 100644 index 0000000000..4913bdd9a8 --- /dev/null +++ b/lib/line.tcl @@ -0,0 +1,64 @@ +# goto line number +# based on code from gitk, Copyright (C) Paul Mackerras + +class linebar { + +field w +field ctext + +field linenum {} + +constructor new {i_w i_text args} { + global use_ttk NS + set w $i_w + set ctext $i_text + + ${NS}::frame $w + ${NS}::label $w.l -text [mc "Goto Line:"] + entry $w.ent -textvariable ${__this}::linenum -background lightgreen + ${NS}::button $w.bn -text [mc Go] -command [cb _incrgoto] + + pack $w.l -side left + pack $w.bn -side right + pack $w.ent -side left -expand 1 -fill x + + eval grid conf $w -sticky we $args + grid remove $w + + bind $w.ent [cb _incrgoto] + bind $w.ent [list linebar::hide $this] + + bind $w [list delete_this $this] + return $this +} + +method show {} { + if {![visible $this]} { + grid $w + } + focus -force $w.ent +} + +method hide {} { + if {[visible $this]} { + focus $ctext + grid remove $w + } +} + +method visible {} { + return [winfo ismapped $w] +} + +method editor {} { + return $w.ent +} + +method _incrgoto {} { + if {$linenum ne {}} { + $ctext see $linenum.0 + hide $this + } +} + +} From af9a4625fa7aeeb5bc52eed3af7e19579af31f42 Mon Sep 17 00:00:00 2001 From: David Fries Date: Sat, 16 Jul 2011 11:59:45 -0500 Subject: [PATCH 07/13] git-gui: Add keyboard shortcuts for search and goto commands in blame view. Use forward-slash or Control-S to bring up the search dialog. In the blame view, Enter or 'n' jump to the next selected region while Shift-Enter or Shift-n will jump to the previous selected region. Within the search control, hitting Enter will now jump to the next matching region. Signed-off-by: David Fries Signed-off-by: Pat Thoyts --- lib/blame.tcl | 4 ++++ lib/search.tcl | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/blame.tcl b/lib/blame.tcl index 14fde81761..bc81e29b43 100644 --- a/lib/blame.tcl +++ b/lib/blame.tcl @@ -352,9 +352,13 @@ constructor new {i_commit i_path i_jump} { bind $w_cviewer [list focus $w_cviewer] bind $w_file [cb _focus_search $w_file] bind $top [list searchbar::show $finder] + bind $top [list searchbar::show $finder] + bind $top [list searchbar::show $finder] bind $top [list searchbar::hide $finder] bind $top [list searchbar::find_next $finder] + bind $top [list searchbar::find_next $finder] bind $top [list searchbar::find_prev $finder] + bind $top [list searchbar::find_prev $finder] bind $top [list linebar::show $gotoline] catch { bind $top [list searchbar::find_prev $finder] } diff --git a/lib/search.tcl b/lib/search.tcl index 7fdbf87bcd..ef3486f083 100644 --- a/lib/search.tcl +++ b/lib/search.tcl @@ -35,6 +35,8 @@ constructor new {i_w i_text args} { grid remove $w trace add variable searchstring write [cb _incrsearch_cb] + bind $w.ent [cb find_next] + bind $w.ent [cb find_prev] bind $w [list delete_this $this] return $this @@ -196,4 +198,4 @@ method scrolled {} { } } -} \ No newline at end of file +} From 29776c75d0ed79c544601b1630d532f9e121b9c7 Mon Sep 17 00:00:00 2001 From: Pat Thoyts Date: Tue, 19 Jul 2011 15:33:34 +0100 Subject: [PATCH 08/13] git-gui: drop the 'n' and 'Shift-n' bindings from the last patch. The 'n' binding should cause the next match to be selected but results in the search field gaining focus and additional 'n's being appended. Signed-off-by: Pat Thoyts --- lib/blame.tcl | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/blame.tcl b/lib/blame.tcl index bc81e29b43..2099776f12 100644 --- a/lib/blame.tcl +++ b/lib/blame.tcl @@ -356,9 +356,7 @@ constructor new {i_commit i_path i_jump} { bind $top [list searchbar::show $finder] bind $top [list searchbar::hide $finder] bind $top [list searchbar::find_next $finder] - bind $top [list searchbar::find_next $finder] bind $top [list searchbar::find_prev $finder] - bind $top [list searchbar::find_prev $finder] bind $top [list linebar::show $gotoline] catch { bind $top [list searchbar::find_prev $finder] } From 856c2d75c64b0e7cfc1a8d84ad5344e8b2354085 Mon Sep 17 00:00:00 2001 From: Heiko Voigt Date: Fri, 27 May 2011 17:40:24 +0200 Subject: [PATCH 09/13] git-gui: deal with unknown files when pressing the "Stage Changed" button As a shortcut the "Stage Changed" button can be used to stage all current changes in the worktree which are not set to ignore. Previously unknown files would be ignored. The user might want to say: "Just save everything in my worktree". To support this workflow we now ask whether the user also wants to stage the unknown files if there are some present. Signed-off-by: Heiko Voigt Signed-off-by: Pat Thoyts --- lib/index.tcl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/index.tcl b/lib/index.tcl index 5d7bbf23ed..e38b647b71 100644 --- a/lib/index.tcl +++ b/lib/index.tcl @@ -356,12 +356,21 @@ proc do_add_all {} { global file_states set paths [list] + set unknown_paths [list] foreach path [array names file_states] { switch -glob -- [lindex $file_states($path) 0] { U? {continue} ?M - ?T - ?D {lappend paths $path} + ?O {lappend unknown_paths $path} + } + } + if {[llength $unknown_paths]} { + set reply [ask_popup [mc "There are unknown files do you also want +to stage those?"]] + if {$reply} { + set paths [concat $paths $unknown_paths] } } add_helper {Adding all changed files} $paths From e0e0a6c64c5e7fffddc7ab8ef5d17626cf689e47 Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Thu, 13 Oct 2011 15:48:12 +0200 Subject: [PATCH 10/13] git-gui: search and linenumber input are mutual exclusive in the blame view It was possible to open the search input (Ctrl+S) and the goto-line input (Ctrl+G) at the same time. Prevent this. Signed-off-by: Bert Wesarg Signed-off-by: Pat Thoyts --- lib/blame.tcl | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/lib/blame.tcl b/lib/blame.tcl index 2099776f12..691941e959 100644 --- a/lib/blame.tcl +++ b/lib/blame.tcl @@ -280,11 +280,11 @@ constructor new {i_commit i_path i_jump} { $w.ctxm add command \ -label [mc "Find Text..."] \ -accelerator F7 \ - -command [list searchbar::show $finder] + -command [cb _show_finder] $w.ctxm add command \ -label [mc "Goto Line..."] \ -accelerator "Ctrl-G" \ - -command [list linebar::show $gotoline] + -command [cb _show_linebar] menu $w.ctxm.enc build_encoding_menu $w.ctxm.enc [cb _setencoding] $w.ctxm add cascade \ @@ -351,13 +351,13 @@ constructor new {i_commit i_path i_jump} { bind $w_cviewer "[list focus $w_file];break" bind $w_cviewer [list focus $w_cviewer] bind $w_file [cb _focus_search $w_file] - bind $top [list searchbar::show $finder] - bind $top [list searchbar::show $finder] - bind $top [list searchbar::show $finder] + bind $top [cb _show_finder] + bind $top [cb _show_finder] + bind $top [cb _show_finder] bind $top [list searchbar::hide $finder] bind $top [list searchbar::find_next $finder] bind $top [list searchbar::find_prev $finder] - bind $top [list linebar::show $gotoline] + bind $top [cb _show_linebar] catch { bind $top [list searchbar::find_prev $finder] } grid configure $w.header -sticky ew @@ -1349,4 +1349,14 @@ method _resize {new_height} { set old_height $new_height } +method _show_finder {} { + linebar::hide $gotoline + searchbar::show $finder +} + +method _show_linebar {} { + searchbar::hide $finder + linebar::show $gotoline +} + } From 59252107ac24d5efb0d411ef4c2b279aa217cd7d Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Thu, 13 Oct 2011 15:48:14 +0200 Subject: [PATCH 11/13] git-gui: only accept numbers in the goto-line input Signed-off-by: Bert Wesarg Signed-off-by: Pat Thoyts --- lib/line.tcl | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/line.tcl b/lib/line.tcl index 4913bdd9a8..904722e677 100644 --- a/lib/line.tcl +++ b/lib/line.tcl @@ -15,7 +15,11 @@ constructor new {i_w i_text args} { ${NS}::frame $w ${NS}::label $w.l -text [mc "Goto Line:"] - entry $w.ent -textvariable ${__this}::linenum -background lightgreen + entry $w.ent \ + -textvariable ${__this}::linenum \ + -background lightgreen \ + -validate key \ + -validatecommand [cb _validate %P] ${NS}::button $w.bn -text [mc Go] -command [cb _incrgoto] pack $w.l -side left @@ -26,7 +30,7 @@ constructor new {i_w i_text args} { grid remove $w bind $w.ent [cb _incrgoto] - bind $w.ent [list linebar::hide $this] + bind $w.ent [cb hide] bind $w [list delete_this $this] return $this @@ -54,6 +58,11 @@ method editor {} { return $w.ent } +method _validate {P} { + # only accept numbers as input + string is integer $P +} + method _incrgoto {} { if {$linenum ne {}} { $ctext see $linenum.0 From 81a92e52059b3e2246142650b1282c6f21f49507 Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Thu, 13 Oct 2011 15:48:13 +0200 Subject: [PATCH 12/13] git-gui: clear the goto line input when hiding Signed-off-by: Bert Wesarg Signed-off-by: Pat Thoyts --- lib/line.tcl | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/line.tcl b/lib/line.tcl index 904722e677..ee27bd257a 100644 --- a/lib/line.tcl +++ b/lib/line.tcl @@ -45,6 +45,7 @@ method show {} { method hide {} { if {[visible $this]} { + $w.ent delete 0 end focus $ctext grid remove $w } From 843d6597fbacfae02b8af7d6840992c92d0863f8 Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Thu, 13 Oct 2011 15:48:15 +0200 Subject: [PATCH 13/13] git-gui: incremental goto line in blame view The view jumps now to the given line number after each key press. Signed-off-by: Bert Wesarg Signed-off-by: Pat Thoyts --- lib/line.tcl | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/line.tcl b/lib/line.tcl index ee27bd257a..c160012de6 100644 --- a/lib/line.tcl +++ b/lib/line.tcl @@ -20,7 +20,7 @@ constructor new {i_w i_text args} { -background lightgreen \ -validate key \ -validatecommand [cb _validate %P] - ${NS}::button $w.bn -text [mc Go] -command [cb _incrgoto] + ${NS}::button $w.bn -text [mc Go] -command [cb _goto] pack $w.l -side left pack $w.bn -side right @@ -29,7 +29,8 @@ constructor new {i_w i_text args} { eval grid conf $w -sticky we $args grid remove $w - bind $w.ent [cb _incrgoto] + trace add variable linenum write [cb _goto_cb] + bind $w.ent [cb _goto] bind $w.ent [cb hide] bind $w [list delete_this $this] @@ -64,10 +65,16 @@ method _validate {P} { string is integer $P } -method _incrgoto {} { +method _goto_cb {name ix op} { + after idle [cb _goto 1] +} + +method _goto {{nohide {0}}} { if {$linenum ne {}} { $ctext see $linenum.0 - hide $this + if {!$nohide} { + hide $this + } } }