git-gui: Remove Pull menu and cleanup Branch/Fetch/Push menus.
The Pull menu as it stands right now is a really horrible idea. Most users will have too many branches show up in this menu, and what with the new globbing syntax for fetch entries we were offering up possible merging that just isn't really valid. So this menu is dead and will be rewritten to support better merge capabilities. The Branch menu shouldn't include a separator entry if there are no branches, it just looks too damn weird. This can happen in an initial repository before any branches have been created and before the first commit. The Fetch and Push menus should just be organized around their own menus rather than being given the menu to populate. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
parent
fb08baca33
commit
3f7fd924a9
52
git-gui.sh
52
git-gui.sh
@ -1822,7 +1822,9 @@ proc populate_branch_menu {} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if {$all_heads ne {}} {
|
||||||
$m add separator
|
$m add separator
|
||||||
|
}
|
||||||
foreach b $all_heads {
|
foreach b $all_heads {
|
||||||
$m add radiobutton \
|
$m add radiobutton \
|
||||||
-label $b \
|
-label $b \
|
||||||
@ -2429,9 +2431,10 @@ proc load_all_remotes {} {
|
|||||||
set all_remotes [lsort -unique $all_remotes]
|
set all_remotes [lsort -unique $all_remotes]
|
||||||
}
|
}
|
||||||
|
|
||||||
proc populate_fetch_menu {m} {
|
proc populate_fetch_menu {} {
|
||||||
global all_remotes repo_config
|
global all_remotes repo_config
|
||||||
|
|
||||||
|
set m .mbar.fetch
|
||||||
foreach r $all_remotes {
|
foreach r $all_remotes {
|
||||||
set enable 0
|
set enable 0
|
||||||
if {![catch {set a $repo_config(remote.$r.url)}]} {
|
if {![catch {set a $repo_config(remote.$r.url)}]} {
|
||||||
@ -2460,9 +2463,10 @@ proc populate_fetch_menu {m} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
proc populate_push_menu {m} {
|
proc populate_push_menu {} {
|
||||||
global all_remotes repo_config
|
global all_remotes repo_config
|
||||||
|
|
||||||
|
set m .mbar.push
|
||||||
foreach r $all_remotes {
|
foreach r $all_remotes {
|
||||||
set enable 0
|
set enable 0
|
||||||
if {![catch {set a $repo_config(remote.$r.url)}]} {
|
if {![catch {set a $repo_config(remote.$r.url)}]} {
|
||||||
@ -2491,43 +2495,6 @@ proc populate_push_menu {m} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
proc populate_pull_menu {m} {
|
|
||||||
global repo_config all_remotes disable_on_lock
|
|
||||||
|
|
||||||
foreach remote $all_remotes {
|
|
||||||
set rb_list [list]
|
|
||||||
if {[array get repo_config remote.$remote.url] ne {}} {
|
|
||||||
if {[array get repo_config remote.$remote.fetch] ne {}} {
|
|
||||||
foreach line $repo_config(remote.$remote.fetch) {
|
|
||||||
if {[regexp {^([^:]+):} $line line rb]} {
|
|
||||||
lappend rb_list $rb
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
catch {
|
|
||||||
set fd [open [gitdir remotes $remote] r]
|
|
||||||
while {[gets $fd line] >= 0} {
|
|
||||||
if {[regexp {^Pull:[ \t]*([^:]+):} $line line rb]} {
|
|
||||||
lappend rb_list $rb
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close $fd
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach rb $rb_list {
|
|
||||||
regsub ^refs/heads/ $rb {} rb_short
|
|
||||||
$m add command \
|
|
||||||
-label "Branch $rb_short from $remote..." \
|
|
||||||
-command [list pull_remote $remote $rb] \
|
|
||||||
-font font_ui
|
|
||||||
lappend disable_on_lock \
|
|
||||||
[list $m entryconf [$m index last] -state]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
##
|
##
|
||||||
## icons
|
## icons
|
||||||
@ -3751,7 +3718,6 @@ if {!$single_commit} {
|
|||||||
.mbar add cascade -label Commit -menu .mbar.commit
|
.mbar add cascade -label Commit -menu .mbar.commit
|
||||||
if {!$single_commit} {
|
if {!$single_commit} {
|
||||||
.mbar add cascade -label Fetch -menu .mbar.fetch
|
.mbar add cascade -label Fetch -menu .mbar.fetch
|
||||||
.mbar add cascade -label Pull -menu .mbar.pull
|
|
||||||
.mbar add cascade -label Push -menu .mbar.push
|
.mbar add cascade -label Push -menu .mbar.push
|
||||||
}
|
}
|
||||||
. configure -menu .mbar
|
. configure -menu .mbar
|
||||||
@ -3929,7 +3895,6 @@ lappend disable_on_lock \
|
|||||||
#
|
#
|
||||||
if {!$single_commit} {
|
if {!$single_commit} {
|
||||||
menu .mbar.fetch
|
menu .mbar.fetch
|
||||||
menu .mbar.pull
|
|
||||||
menu .mbar.push
|
menu .mbar.push
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4565,9 +4530,8 @@ if {!$single_commit} {
|
|||||||
load_all_heads
|
load_all_heads
|
||||||
|
|
||||||
populate_branch_menu
|
populate_branch_menu
|
||||||
populate_fetch_menu .mbar.fetch
|
populate_fetch_menu
|
||||||
populate_pull_menu .mbar.pull
|
populate_push_menu
|
||||||
populate_push_menu .mbar.push
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# -- Only suggest a gc run if we are going to stay running.
|
# -- Only suggest a gc run if we are going to stay running.
|
||||||
|
Loading…
Reference in New Issue
Block a user