@matheusbsbs / matheus-bagliano / commits / 5dc2cae6f4
Fork 0

git-gui: Completely remove support for creating octopus merges

I'm working on refactoring the UI of the merge dialog, because as it currently stands the dialog is absolutely horrible, especially when you have 200+ branches available from a single remote system. In that refactoring I plan on using the choose_rev widget to allow the user to select exactly which branch/commit they want to merge. However since that only selects a single commit I'm first removing the code that supports octopus merges. A brief consultation on #git tonight seemed to indicate that the octopus merge strategy is not as useful as originally thought when it was invented, and that most people don't commonly use them. So making users fall back to the command line to create an octopus is actually maybe a good idea here, as they might think twice before they use it. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Jul 19, 2007 at 02:24 UTC 5dc2cae6f4c5d7218c4323ceafb96ab8469be52e
1 file changed +17 -68
lib/merge.tcl
+17 -68
@@ -67,95 +67,44 @@ You should complete the current commit before starting a merge. Doing so will h
67 return 1
68 }
69
70 -method _refs {} {
71 - set r {}
72 - foreach i [$w_list curselection] {
73 - lappend r [lindex [lindex $list $i] 0]
70 +method _rev {} {
71 + set i [$w_list curselection]
72 + if {$i >= 0} {
73 + return [lindex [lindex $list $i] 0]
74 }
75 - return $r
75 + return {}
76 }
77
78 method _visualize {} {
79 - set revs [_refs $this]
80 - if {$revs eq {}} return
81 - lappend revs --not HEAD
82 - do_gitk $revs
79 + set rev [_rev $this]
80 + if {$rev ne {}} {
81 + do_gitk [list $rev --not HEAD]
82 + }
83 }
84
85 method _start {} {
86 global HEAD current_branch
87
88 - set cmd [list git merge]
89 - set names [_refs $this]
90 - set revcnt [llength $names]
91 - append cmd { } $names
92 -
93 - if {$revcnt == 0} {
94 - return
95 - } elseif {$revcnt == 1} {
96 - set unit branch
97 - } elseif {$revcnt <= 15} {
98 - set unit branches
99 -
100 - if {[tk_dialog \
101 - $w.confirm_octopus \
102 - [wm title $w] \
103 - "Use octopus merge strategy?
104 -
105 -You are merging $revcnt branches at once. This requires using the octopus merge driver, which may not succeed if there are file-level conflicts.
106 -" \
107 - question \
108 - 0 \
109 - {Cancel} \
110 - {Use octopus} \
111 - ] != 1} return
112 - } else {
113 - tk_messageBox \
114 - -icon error \
115 - -type ok \
116 - -title [wm title $w] \
117 - -parent $w \
118 - -message "Too many branches selected.
119 -
120 -You have requested to merge $revcnt branches in an octopus merge. This exceeds Git's internal limit of 15 branches per merge.
121 -
122 -Please select fewer branches. To merge more than 15 branches, merge the branches in batches.
123 -"
88 + set name [_rev $this]
89 + if {$name eq {}} {
90 return
91 }
92
127 - set msg "Merging $current_branch, [join $names {, }]"
93 + set cmd [list git merge $name]
94 + set msg "Merging $current_branch and $name"
95 ui_status "$msg..."
129 - set cons [console::new "Merge" $msg]
130 - console::exec $cons $cmd [cb _finish $revcnt $cons]
96 + set cons [console::new "Merge" $cmd]
97 + console::exec $cons $cmd [cb _finish $cons]
98
99 wm protocol $w WM_DELETE_WINDOW {}
100 destroy $w
101 }
102
136 -method _finish {revcnt cons ok} {
103 +method _finish {cons ok} {
104 console::done $cons $ok
105 if {$ok} {
106 set msg {Merge completed successfully.}
107 } else {
141 - if {$revcnt != 1} {
142 - info_popup "Octopus merge failed.
143 -
144 -Your merge of $revcnt branches has failed.
145 -
146 -There are file-level conflicts between the branches which must be resolved manually.
147 -
148 -The working directory will now be reset.
149 -
150 -You can attempt this merge again by merging only one branch at a time." $w
151 -
152 - set fd [git_read read-tree --reset -u HEAD]
153 - fconfigure $fd -blocking 0 -translation binary
154 - fileevent $fd readable [cb _reset_wait $fd]
155 - ui_status {Aborting... please wait...}
156 - return
157 - }
158 -
108 set msg {Merge failed. Conflict resolution is required.}
109 }
110 unlock_index
@@ -235,7 +184,7 @@ constructor dialog {} {
184 -height 10 \
185 -width 70 \
186 -font font_diff \
238 - -selectmode extended \
187 + -selectmode browse \
188 -yscrollcommand [list $w.source.sby set]
189 scrollbar $w.source.sby -command [list $w_list yview]
190 pack $w.source.sby -side right -fill y