@matheusbsbs / matheus-bagliano / commits / d075242923
Fork 0

git-gui: Added menu command to visualize all branches.

Sometimes its useful to start gitk with the --all option, to view all of the known branches and tags within this repository. Rather than making the user startup gitk and then edit the view we can pass the option along for them. This also makes it slightly more explicit, that when gitk starts up by default its showing the current branch and not everything. Yes gitk isn't showing that to the user, but the fact that the user had to make a decision between seeing this current branch or all branches will hopefully make them study gitk's display before jumping to a conclusion. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Nov 21, 2006 at 20:33 UTC d075242923691e5f3c671f240945b0bdf26a7cd0
1 file changed +26 -13
git-gui
+26 -13
@@ -1959,20 +1959,28 @@ proc console_read {w fd after} {
1959
1960 set starting_gitk_msg {Please wait... Starting gitk...}
1961
1962 -proc do_gitk {} {
1962 +proc do_gitk {revs} {
1963 global ui_status_value starting_gitk_msg
1964
1965 - set ui_status_value $starting_gitk_msg
1966 - after 10000 {
1967 - if {$ui_status_value eq $starting_gitk_msg} {
1968 - set ui_status_value {Ready.}
1969 - }
1965 + set cmd gitk
1966 + if {$revs ne {}} {
1967 + append cmd { }
1968 + append cmd $revs
1969 }
1971 -
1970 if {[is_Windows]} {
1973 - exec sh -c gitk &
1971 + set cmd "sh -c \"exec $cmd\""
1972 + }
1973 + append cmd { &}
1974 +
1975 + if {[catch {eval exec $cmd} err]} {
1976 + error_popup "Failed to start gitk:\n\n$err"
1977 } else {
1975 - exec gitk &
1978 + set ui_status_value $starting_gitk_msg
1979 + after 10000 {
1980 + if {$ui_status_value eq $starting_gitk_msg} {
1981 + set ui_status_value {Ready.}
1982 + }
1983 + }
1984 }
1985 }
1986
@@ -2701,12 +2709,17 @@ if {!$single_commit} {
2709 # -- Repository Menu
2710 #
2711 menu .mbar.repository
2704 -.mbar.repository add command -label Visualize \
2705 - -command do_gitk \
2712 +.mbar.repository add command \
2713 + -label {Visualize Current Branch} \
2714 + -command {do_gitk {}} \
2715 -font font_ui
2707 -if {!$single_commit} {
2708 - .mbar.repository add separator
2716 +.mbar.repository add command \
2717 + -label {Visualize All Branches} \
2718 + -command {do_gitk {--all}} \
2719 + -font font_ui
2720 +.mbar.repository add separator
2721
2722 +if {!$single_commit} {
2723 .mbar.repository add command -label {Repack Database} \
2724 -command do_repack \
2725 -font font_ui