@matheusbsbs / matheus-bagliano / commits / 557afe820b
Fork 0

git-gui: Created very crude Tools menu, to support miga.

In one particular case I have a tool called 'miga' which users may need to invoke on their repository. This is a homegrown tool which is not (and should be) part of git-gui, but I still want to be able to run it from within the gui. Right now I'm taking a shortcut and adding it to the Tools menu if we are not on Mac OS X and the support script used to launch the tool exists in the local filesystem. This is nothing but a complete and utter hack. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Dec 7, 2006 at 22:07 UTC 557afe820baccb21206c974fbd4afa65bd7f1e03
1 file changed +29
git-gui
+29
@@ -3210,6 +3210,35 @@ if {[is_MacOSX]} {
3210 -command do_options \
3211 -font font_ui
3212
3213 + # -- Tools Menu
3214 + #
3215 + if {[file exists /usr/local/miga/lib/gui-miga]} {
3216 + proc do_miga {} {
3217 + global gitdir ui_status_value
3218 + if {![lock_index update]} return
3219 + set cmd [list sh --login -c "/usr/local/miga/lib/gui-miga \"[pwd]\""]
3220 + set miga_fd [open "|$cmd" r]
3221 + fconfigure $miga_fd -blocking 0
3222 + fileevent $miga_fd readable [list miga_done $miga_fd]
3223 + set ui_status_value {Running miga...}
3224 + }
3225 + proc miga_done {fd} {
3226 + read $fd 512
3227 + if {[eof $fd]} {
3228 + close $fd
3229 + unlock_index
3230 + rescan [list set ui_status_value {Ready.}]
3231 + }
3232 + }
3233 + .mbar add cascade -label Tools -menu .mbar.tools
3234 + menu .mbar.tools
3235 + .mbar.tools add command -label "Migrate" \
3236 + -command do_miga \
3237 + -font font_ui
3238 + lappend disable_on_lock \
3239 + [list .mbar.tools entryconf [.mbar.tools index last] -state]
3240 + }
3241 +
3242 # -- Help Menu
3243 #
3244 .mbar add cascade -label Help -menu .mbar.help