{"thread":{"id":"19155","subject":"[PATCH 1/2] git-gui: move gitk launcher into a separate file","startedAt":"2009-05-02T09:20:53Z","lastAt":"2009-05-02T09:20:54Z","messageCount":2,"participants":["Markus Heidelberg"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"112870","messageId":"1241256054-14117-1-git-send-email-markus.heidelberg@web.de","threadId":"19155","inReplyTo":null,"subject":"[PATCH 1/2] git-gui: move gitk launcher into a separate file","fromName":"Markus Heidelberg","fromEmail":"markus.heidelberg@web.de","sentAt":"2009-05-02T09:20:53Z","receivedAt":"2009-05-02T09:20:53Z","isPatch":true,"sender":{"key":"markus.heidelberg@web.de","avatar":"https://avatars.githubusercontent.com/u/6334512?v=4"},"body":"\nSigned-off-by: Markus Heidelberg <markus.heidelberg@web.de>\n---\n git-gui.sh   |   39 ---------------------------------------\n lib/gitk.tcl |   41 +++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 41 insertions(+), 39 deletions(-)\n create mode 100644 lib/gitk.tcl\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex 14b92ba..6ff04c4 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -1902,45 +1902,6 @@ proc incr_font_size {font {amt 1}} {\n ##\n ## ui commands\n \n-set starting_gitk_msg [mc \"Starting gitk... please wait...\"]\n-\n-proc do_gitk {revs} {\n-\t# -- Always start gitk through whatever we were loaded with.  This\n-\t#    lets us bypass using shell process on Windows systems.\n-\t#\n-\tset exe [_which gitk -script]\n-\tset cmd [list [info nameofexecutable] $exe]\n-\tif {$exe eq {}} {\n-\t\terror_popup [mc \"Couldn't find gitk in PATH\"]\n-\t} else {\n-\t\tglobal env\n-\n-\t\tif {[info exists env(GIT_DIR)]} {\n-\t\t\tset old_GIT_DIR $env(GIT_DIR)\n-\t\t} else {\n-\t\t\tset old_GIT_DIR {}\n-\t\t}\n-\n-\t\tset pwd [pwd]\n-\t\tcd [file dirname [gitdir]]\n-\t\tset env(GIT_DIR) [file tail [gitdir]]\n-\n-\t\teval exec $cmd $revs &\n-\n-\t\tif {$old_GIT_DIR eq {}} {\n-\t\t\tunset env(GIT_DIR)\n-\t\t} else {\n-\t\t\tset env(GIT_DIR) $old_GIT_DIR\n-\t\t}\n-\t\tcd $pwd\n-\n-\t\tui_status $::starting_gitk_msg\n-\t\tafter 10000 {\n-\t\t\tui_ready $starting_gitk_msg\n-\t\t}\n-\t}\n-}\n-\n proc do_explore {} {\n \tset explorer {}\n \tif {[is_Cygwin] || [is_Windows]} {\ndiff --git a/lib/gitk.tcl b/lib/gitk.tcl\nnew file mode 100644\nindex 0000000..fcbb73d\n--- /dev/null\n+++ b/lib/gitk.tcl\n@@ -0,0 +1,41 @@\n+# git-gui gitk launcher\n+# Copyright (C) 2006, 2007 Shawn Pearce\n+\n+set starting_gitk_msg [mc \"Starting gitk... please wait...\"]\n+\n+proc do_gitk {revs} {\n+\t# -- Always start gitk through whatever we were loaded with.  This\n+\t#    lets us bypass using shell process on Windows systems.\n+\t#\n+\tset exe [_which gitk -script]\n+\tset cmd [list [info nameofexecutable] $exe]\n+\tif {$exe eq {}} {\n+\t\terror_popup [mc \"Couldn't find gitk in PATH\"]\n+\t} else {\n+\t\tglobal env\n+\n+\t\tif {[info exists env(GIT_DIR)]} {\n+\t\t\tset old_GIT_DIR $env(GIT_DIR)\n+\t\t} else {\n+\t\t\tset old_GIT_DIR {}\n+\t\t}\n+\n+\t\tset pwd [pwd]\n+\t\tcd [file dirname [gitdir]]\n+\t\tset env(GIT_DIR) [file tail [gitdir]]\n+\n+\t\teval exec $cmd $revs &\n+\n+\t\tif {$old_GIT_DIR eq {}} {\n+\t\t\tunset env(GIT_DIR)\n+\t\t} else {\n+\t\t\tset env(GIT_DIR) $old_GIT_DIR\n+\t\t}\n+\t\tcd $pwd\n+\n+\t\tui_status $::starting_gitk_msg\n+\t\tafter 10000 {\n+\t\t\tui_ready $starting_gitk_msg\n+\t\t}\n+\t}\n+}\n-- \n1.6.3.rc3.79.g777c\n"},{"id":"112871","messageId":"1241256054-14117-2-git-send-email-markus.heidelberg@web.de","threadId":"19155","inReplyTo":"1241256054-14117-1-git-send-email-markus.heidelberg@web.de","subject":"[PATCH 2/2] git-gui: add menu item to select a branch to visualize with gitk","fromName":"Markus Heidelberg","fromEmail":"markus.heidelberg@web.de","sentAt":"2009-05-02T09:20:54Z","receivedAt":"2009-05-02T09:20:54Z","isPatch":true,"sender":{"key":"markus.heidelberg@web.de","avatar":"https://avatars.githubusercontent.com/u/6334512?v=4"},"body":"Previously it was only possible to either visualize the history of the\ncurrent branch or of all branches. This new menu item \"Visualize Branch\nHistory...\" is similar to the existing \"Browse Branch Files...\" item.\n\nThe gitk_open class was straight copied from the browser_open class with\nmerely adjusting the UI text and the command to execute.\n\nSigned-off-by: Markus Heidelberg <markus.heidelberg@web.de>\n---\n git-gui.sh   |    3 +++\n lib/gitk.tcl |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 56 insertions(+), 0 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex 6ff04c4..9ceaf6f 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -2310,6 +2310,9 @@ set ui_browse_current [.mbar.repository index last]\n \t-command {do_gitk $current_branch}\n set ui_visualize_current [.mbar.repository index last]\n .mbar.repository add command \\\n+\t-label [mc \"Visualize Branch History...\"] \\\n+\t-command gitk_open::dialog\n+.mbar.repository add command \\\n \t-label [mc \"Visualize All Branch History\"] \\\n \t-command {do_gitk --all}\n .mbar.repository add separator\ndiff --git a/lib/gitk.tcl b/lib/gitk.tcl\nindex fcbb73d..251ab45 100644\n--- a/lib/gitk.tcl\n+++ b/lib/gitk.tcl\n@@ -39,3 +39,56 @@ proc do_gitk {revs} {\n \t\t}\n \t}\n }\n+\n+class gitk_open {\n+\n+field w              ; # widget path\n+field w_rev          ; # mega-widget to pick the initial revision\n+\n+constructor dialog {} {\n+\tmake_toplevel top w\n+\twm title $top [append \"[appname] ([reponame]): \" [mc \"Visualize Branch History\"]]\n+\tif {$top ne {.}} {\n+\t\twm geometry $top \"+[winfo rootx .]+[winfo rooty .]\"\n+\t}\n+\n+\tlabel $w.header \\\n+\t\t-text [mc \"Visualize Branch History\"] \\\n+\t\t-font font_uibold\n+\tpack $w.header -side top -fill x\n+\n+\tframe $w.buttons\n+\tbutton $w.buttons.browse -text [mc Visualize] \\\n+\t\t-default active \\\n+\t\t-command [cb _open]\n+\tpack $w.buttons.browse -side right\n+\tbutton $w.buttons.cancel -text [mc Cancel] \\\n+\t\t-command [list destroy $w]\n+\tpack $w.buttons.cancel -side right -padx 5\n+\tpack $w.buttons -side bottom -fill x -pady 10 -padx 10\n+\n+\tset w_rev [::choose_rev::new $w.rev [mc Revision]]\n+\t$w_rev bind_listbox <Double-Button-1> [cb _open]\n+\tpack $w.rev -anchor nw -fill both -expand 1 -pady 5 -padx 5\n+\n+\tbind $w <Visibility> [cb _visible]\n+\tbind $w <Key-Escape> [list destroy $w]\n+\tbind $w <Key-Return> [cb _open]\\;break\n+\ttkwait window $w\n+}\n+\n+method _open {} {\n+\tif {[catch {$w_rev commit_or_die} err]} {\n+\t\treturn\n+\t}\n+\tset name [$w_rev get]\n+\tdestroy $w\n+\tdo_gitk $name\n+}\n+\n+method _visible {} {\n+\tgrab $w\n+\t$w_rev focus_filter\n+}\n+\n+}\n-- \n1.6.3.rc3.79.g777c\n"}]}