7 set lily_dir
$env(HOME
)/lilypond
8 if {[file exists
$lily_dir]} {
12 proc write_to_output
{s
} {
13 .output.
text insert insert
$s
17 proc write_file_to_output
{f
} {
20 fconfigure $f -blocking true
21 if {[catch {close $f} err
]} {
22 tk_messageBox -type ok
-message "Git aborted: $err"
26 write_to_output
[read $f 24]
31 global lily_dir git_command
32 set git_command
[linsert $args 0 "|git" "--git-dir=$lily_dir/.git"]
33 set git_command
"$git_command 2>@1"
34 #.output.text insert end "$git_command\n"
35 set git
[open $git_command r
]
36 fconfigure $git -blocking false
37 fileevent $git readable
[list write_file_to_output
$git]
43 set p
[open [linsert $args 0 "|git" --git-dir
=$lily_dir/.git config
] r
]
44 set result
[regsub "\n\$" [read $p] ""]
45 if {[catch {close $p} err
]} {
46 tk_messageBox -type ok
-message "config failed: $err"
51 proc config_quiet
{args
} {
53 set p
[open [linsert $args 0 "|git" --git-dir
=$lily_dir/.git config
] r
]
54 set result
[regsub "\n\$" [read $p] ""]
55 if {[catch {close $p} err
]} {
61 proc update_lilypond
{} {
63 . config
-cursor watch
64 if {![file exists
$lily_dir]} {
65 write_to_output
"Cloning LilyPond (this can take some time) ...\n"
69 git config core.bare false
70 git remote add
-t master
\
71 origin git
://repo.or.cz
/lilypond.git
73 git reset
--hard origin
/master
74 git config branch.master.remote origin
75 git config branch.master.merge refs
/heads
/master
76 .buttons.
update configure
-text "Update LilyPond"
79 write_to_output
"Updating LilyPond...\n"
82 git rebase origin
/master
84 git merge origin
/master
87 write_to_output
"Done.\n"
91 proc toggle_rebase
{} {
93 config
--bool branch.master.rebase
$rebase
98 wm title .
"LilyPond Contributor's GUI"
103 button .buttons.
update -text "Update LilyPond" -command update_lilypond
104 label .buttons.rebase_label
-text "Rebase"
105 if {![file exists
$lily_dir]} {
106 .buttons.
update configure
-text "Clone LilyPond"
109 if {[config_quiet
--bool branch.master.rebase
] == true
} {
112 checkbutton .buttons.rebase
-variable rebase
-command toggle_rebase
113 pack .buttons.
update -side left
114 pack .buttons.rebase
-side right
115 pack .buttons.rebase_label
-side right
120 text .output.
text -width 80 -height 15 \
121 -xscrollcommand [list .output.horizontal
set] \
122 -yscrollcommand [list .output.vertical
set]
123 scrollbar .output.horizontal
-orient h
-command [list .output.
text xview
]
124 scrollbar .output.vertical
-orient v
-command [list .output.
text yview
]
125 pack .output.horizontal
-side bottom
-fill x
126 pack .output.vertical
-side right
-fill y
127 pack .output.
text -expand true
-anchor nw
-fill both
129 pack .buttons .output