git-gui: Show all fetched branches for remote pulls.
Loop through every remote.<name>.fetch entry and add it as a valid option in the Pull menu. This way users can pull any remote branch that they track, without needing to leave the gui. Its a rather crude work around for not having a full merge interface. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
parent
557afe820b
commit
51e7e568c0
17
git-gui
17
git-gui
@ -1819,28 +1819,29 @@ proc populate_pull_menu {m} {
|
|||||||
global gitdir repo_config all_remotes disable_on_lock
|
global gitdir repo_config all_remotes disable_on_lock
|
||||||
|
|
||||||
foreach remote $all_remotes {
|
foreach remote $all_remotes {
|
||||||
set rb {}
|
set rb_list [list]
|
||||||
if {[array get repo_config remote.$remote.url] ne {}} {
|
if {[array get repo_config remote.$remote.url] ne {}} {
|
||||||
if {[array get repo_config remote.$remote.fetch] ne {}} {
|
if {[array get repo_config remote.$remote.fetch] ne {}} {
|
||||||
regexp {^([^:]+):} \
|
foreach line $repo_config(remote.$remote.fetch) {
|
||||||
[lindex $repo_config(remote.$remote.fetch) 0] \
|
if {[regexp {^([^:]+):} $line line rb]} {
|
||||||
line rb
|
lappend rb_list $rb
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
catch {
|
catch {
|
||||||
set fd [open [file join $gitdir remotes $remote] r]
|
set fd [open [file join $gitdir remotes $remote] r]
|
||||||
while {[gets $fd line] >= 0} {
|
while {[gets $fd line] >= 0} {
|
||||||
if {[regexp {^Pull:[ \t]*([^:]+):} $line line rb]} {
|
if {[regexp {^Pull:[ \t]*([^:]+):} $line line rb]} {
|
||||||
break
|
lappend rb_list $rb
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close $fd
|
close $fd
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set rb_short $rb
|
foreach rb $rb_list {
|
||||||
regsub ^refs/heads/ $rb {} rb_short
|
regsub ^refs/heads/ $rb {} rb_short
|
||||||
if {$rb_short ne {}} {
|
|
||||||
$m add command \
|
$m add command \
|
||||||
-label "Branch $rb_short from $remote..." \
|
-label "Branch $rb_short from $remote..." \
|
||||||
-command [list pull_remote $remote $rb] \
|
-command [list pull_remote $remote $rb] \
|
||||||
|
Loading…
Reference in New Issue
Block a user