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>
Shawn O. Pearce committed
Jan 25, 2007 at 17:16 UTC
3f7fd924a92c07c0fd4e8bd80b941171097db7f0
1 file changed
+9
-45
git-gui.sh
+9
-45
@@ -1822,7 +1822,9 @@ proc populate_branch_menu {} {
1822
}
1823
}
1824
1825
- $m add separator
1825
+ if {$all_heads ne {}} {
1826
+ $m add separator
1827
+ }
1828
foreach b $all_heads {
1829
$m add radiobutton \
1830
-label $b \
@@ -2429,9 +2431,10 @@ proc load_all_remotes {} {
2431
set all_remotes [lsort -unique $all_remotes]
2432
}
2433
2432
-proc populate_fetch_menu {m} {
2434
+proc populate_fetch_menu {} {
2435
global all_remotes repo_config
2436
2437
+ set m .mbar.fetch
2438
foreach r $all_remotes {
2439
set enable 0
2440
if {![catch {set a $repo_config(remote.$r.url)}]} {
@@ -2460,9 +2463,10 @@ proc populate_fetch_menu {m} {
2463
}
2464
}
2465
2463
-proc populate_push_menu {m} {
2466
+proc populate_push_menu {} {
2467
global all_remotes repo_config
2468
2469
+ set m .mbar.push
2470
foreach r $all_remotes {
2471
set enable 0
2472
if {![catch {set a $repo_config(remote.$r.url)}]} {
@@ -2491,43 +2495,6 @@ proc populate_push_menu {m} {
2495
}
2496
}
2497
2494
-proc populate_pull_menu {m} {
2495
- global repo_config all_remotes disable_on_lock
2496
-
2497
- foreach remote $all_remotes {
2498
- set rb_list [list]
2499
- if {[array get repo_config remote.$remote.url] ne {}} {
2500
- if {[array get repo_config remote.$remote.fetch] ne {}} {
2501
- foreach line $repo_config(remote.$remote.fetch) {
2502
- if {[regexp {^([^:]+):} $line line rb]} {
2503
- lappend rb_list $rb
2504
- }
2505
- }
2506
- }
2507
- } else {
2508
- catch {
2509
- set fd [open [gitdir remotes $remote] r]
2510
- while {[gets $fd line] >= 0} {
2511
- if {[regexp {^Pull:[ \t]*([^:]+):} $line line rb]} {
2512
- lappend rb_list $rb
2513
- }
2514
- }
2515
- close $fd
2516
- }
2517
- }
2518
-
2519
- foreach rb $rb_list {
2520
- regsub ^refs/heads/ $rb {} rb_short
2521
- $m add command \
2522
- -label "Branch $rb_short from $remote..." \
2523
- -command [list pull_remote $remote $rb] \
2524
- -font font_ui
2525
- lappend disable_on_lock \
2526
- [list $m entryconf [$m index last] -state]
2527
- }
2528
- }
2529
-}
2530
-
2498
######################################################################
2499
##
2500
## icons
@@ -3751,7 +3718,6 @@ if {!$single_commit} {
3718
.mbar add cascade -label Commit -menu .mbar.commit
3719
if {!$single_commit} {
3720
.mbar add cascade -label Fetch -menu .mbar.fetch
3754
- .mbar add cascade -label Pull -menu .mbar.pull
3721
.mbar add cascade -label Push -menu .mbar.push
3722
}
3723
. configure -menu .mbar
@@ -3929,7 +3895,6 @@ lappend disable_on_lock \
3895
#
3896
if {!$single_commit} {
3897
menu .mbar.fetch
3932
- menu .mbar.pull
3898
menu .mbar.push
3899
}
3900
@@ -4565,9 +4530,8 @@ if {!$single_commit} {
4530
load_all_heads
4531
4532
populate_branch_menu
4568
- populate_fetch_menu .mbar.fetch
4569
- populate_pull_menu .mbar.pull
4570
- populate_push_menu .mbar.push
4533
+ populate_fetch_menu
4534
+ populate_push_menu
4535
}
4536
4537
# -- Only suggest a gc run if we are going to stay running.