Menu

[r1174]: / branches / tcl9 / tkrev / modbrowse.tcl  Maximize  Restore  History

Download this file

660 lines (591 with data), 25.8 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
#
# Set up a check out dialog.
#
proc modbrowse_setup {} {
global cwd
global cvsroot
global modbrowse_module
global modbrowse_path
global modbrowse_title
global env
global cvsglb
global cvscfg
global colorglb
global tcl_platform
gen_log:log T "ENTER"
set cwd [pwd]
if {[winfo exists .modbrowse]} {
wm deiconify .modbrowse
raise .modbrowse
return
}
# Window manager stuff.
toplevel .modbrowse
wm title .modbrowse "TkRev Repository Browser"
wm iconname .modbrowse "TkRev Repository Browser"
wm iconphoto .modbrowse -default AppIcon
wm minsize .modbrowse 430 300
wm protocol .modbrowse WM_DELETE_WINDOW {.modbrowse.bottom.buttons.close invoke}
wm withdraw .modbrowse
if {[info exists cvscfg(modgeom)]} {
update
wm geometry .modbrowse $cvscfg(modgeom)
}
menubar_menus .modbrowse
modbrowse_menus .modbrowse
help_menu .modbrowse
#
# Top section - module, tags, root
#
frame .modbrowse.top -relief groove -borderwidth 2
pack .modbrowse.top -side top -fill x
label .modbrowse.top.lmcode -text "Module"
entry .modbrowse.top.tmcode -textvariable modbrowse_module \
-font $colorglb(listboxfont) -borderwidth 2
bind .modbrowse.top.tmcode <Return> { modbrowse_run }
# We have these possibilities
foreach VCS {cvs svn git} {
if {[info exists env(${VCS}ROOT)]} {
gen_log:log D "env(${VCS}ROOT) $env(${VCS}ROOT)"
picklist_used cvsroot "$env(${VCS}ROOT)"
}
}
foreach VCS {cvs svn git} {
if {[info exists cvscfg(${VCS}root)]} {
gen_log:log D "cvscfg(${VCS}root) $cvscfg(${VCS}root)"
picklist_used cvsroot "$cvscfg(${VCS}root)"
}
}
# Where do we think we are?
gen_log:log D "cvsglb(root) $cvsglb(root) cvsglb(vcs) $cvsglb(vcs)"
label .modbrowse.top.lroot -text "Repository"
ttk::combobox .modbrowse.top.troot -textvariable cvsglb(root)
.modbrowse.top.troot configure -values $cvsglb(cvsroot)
bind .modbrowse.top.troot <Return> { modbrowse_run }
bind .modbrowse.top.troot <<ComboboxSelected>> { modbrowse_run }
button .modbrowse.top.bworkdir -image Workdir \
-command {workdir_setup}
label .modbrowse.top.lcwd -text "Current Directory"
ttk::combobox .modbrowse.top.tcwd -textvariable cwd
.modbrowse.top.tcwd configure -values $cvsglb(directory)
.modbrowse.top.tcwd configure -values $cvsglb(directory)
bind .modbrowse.top.tcwd <KeyRelease> {set cwd [validate_dirpath %W $cwd]}
bind .modbrowse.top.tcwd <Return> {
if {[change_dir "$cwd"]} {%W configure -foreground black}
}
bind .modbrowse.top.tcwd <<ComboboxSelected>> {
if {[change_dir "$cwd"]} {%W configure -foreground black}
}
grid columnconf .modbrowse.top 1 -weight 1
grid rowconf .modbrowse.top 3 -weight 1
grid .modbrowse.top.lroot -column 0 -row 0 -sticky w
grid .modbrowse.top.troot -column 1 -row 0 -columnspan 2 -padx 4 -sticky ew
grid .modbrowse.top.lmcode -column 0 -row 1 -sticky w
grid .modbrowse.top.tmcode -column 1 -row 1 -padx 3 -sticky ew
grid .modbrowse.top.lcwd -column 0 -row 2 -sticky w
grid .modbrowse.top.tcwd -column 1 -row 2 -padx 4 -sticky ew
grid .modbrowse.top.bworkdir -column 2 -row 1 -rowspan 2 -sticky w
# Pack the bottom before the middle so it doesnt disappear if
# the window is resized smaller
frame .modbrowse.bottom -relief groove -borderwidth 2 -height 128
frame .modbrowse.bottom.buttons
frame .modbrowse.bottom.buttons.cvsfuncs -relief groove -bd 2
frame .modbrowse.bottom.buttons.svnfuncs -relief groove -bd 2
frame .modbrowse.bottom.buttons.modfuncs -relief groove -bd 2
frame .modbrowse.bottom.buttons.closefm
pack .modbrowse.bottom -side bottom -fill x
pack .modbrowse.bottom.buttons -side top -fill x -expand yes
pack .modbrowse.bottom.buttons.closefm -side right -expand yes
pack .modbrowse.bottom.buttons.cvsfuncs -side left
pack .modbrowse.bottom.buttons.svnfuncs -side left -expand yes
pack .modbrowse.bottom.buttons.modfuncs -side left -expand yes
#
# Create buttons
#
button .modbrowse.bottom.buttons.modfuncs.filebrowse -image Files \
-command { browse_files $modbrowse_module }
button .modbrowse.bottom.buttons.modfuncs.patchsummary -image Patches \
-command { dialog_cvs_patch $cvscfg(cvsroot) $modbrowse_module 1 }
button .modbrowse.bottom.buttons.modfuncs.patchfile -image Patchfile \
-command { dialog_cvs_patch $cvscfg(cvsroot) $modbrowse_module 0 }
button .modbrowse.bottom.buttons.modfuncs.checkout -image Checkout \
-command { dialog_cvs_checkout $cvscfg(cvsroot) $modbrowse_module }
button .modbrowse.bottom.buttons.modfuncs.export -image Export \
-command { dialog_cvs_export $cvscfg(cvsroot) $modbrowse_module }
button .modbrowse.bottom.buttons.modfuncs.tag -image Tag \
-command { rtag_dialog $cvscfg(cvsroot) $modbrowse_module "tag" }
button .modbrowse.bottom.buttons.modfuncs.branchtag -image Branchtag \
-command { rtag_dialog $cvscfg(cvsroot) $modbrowse_module "branch" }
button .modbrowse.bottom.buttons.svnfuncs.filecat -image Fileview \
-command { svn_filecat $cvscfg(svnroot) $modbrowse_path $modbrowse_title}
button .modbrowse.bottom.buttons.svnfuncs.filelog -image Log \
-command { svn_filelog $cvscfg(svnroot) $modbrowse_path $modbrowse_title}
button .modbrowse.bottom.buttons.svnfuncs.remove -image SvnRemove \
-command { svn_delete $cvscfg(svnroot) $modbrowse_path }
button .modbrowse.bottom.buttons.cvsfuncs.import -image Import \
-command { cvs_import_setup }
button .modbrowse.bottom.buttons.cvsfuncs.who -image Who \
-command {cvs_history all $modbrowse_module}
button .modbrowse.bottom.buttons.cvsfuncs.brefresh -image Refresh \
-command { modbrowse_run }
button .modbrowse.bottom.buttons.close -text "Close" \
-command { module_exit; exit_cleanup 0 }
grid .modbrowse.bottom.buttons.cvsfuncs.brefresh -column 0 -row 0 \
-ipadx 4 -ipady 4
grid .modbrowse.bottom.buttons.cvsfuncs.who -column 1 -row 0 \
-ipadx 4 -ipady 4
grid .modbrowse.bottom.buttons.cvsfuncs.import -column 2 -row 0 \
-ipadx 4 -ipady 4
grid .modbrowse.bottom.buttons.modfuncs.filebrowse -column 0 -row 0 \
-ipadx 4 -ipady 4
grid .modbrowse.bottom.buttons.modfuncs.checkout -column 1 -row 0 \
-ipadx 4 -ipady 4
grid .modbrowse.bottom.buttons.modfuncs.export -column 2 -row 0 \
-ipadx 4 -ipady 4
grid .modbrowse.bottom.buttons.modfuncs.tag -column 3 -row 0 \
-ipadx 4 -ipady 4
grid .modbrowse.bottom.buttons.modfuncs.branchtag -column 4 -row 0 \
-ipadx 4 -ipady 4
grid .modbrowse.bottom.buttons.modfuncs.patchsummary -column 5 -row 0 \
-ipadx 4 -ipady 4
grid .modbrowse.bottom.buttons.modfuncs.patchfile -column 6 -row 0 \
-ipadx 4 -ipady 4
grid .modbrowse.bottom.buttons.svnfuncs.filecat -column 0 -row 0 \
-ipadx 4 -ipady 4
grid .modbrowse.bottom.buttons.svnfuncs.filelog -column 1 -row 0 \
-ipadx 4 -ipady 4
grid .modbrowse.bottom.buttons.svnfuncs.remove -column 2 -row 0 \
-ipadx 4 -ipady 4
pack .modbrowse.bottom.buttons.close \
-in .modbrowse.bottom.buttons.closefm -side right \
-fill both -expand yes
set_tooltips .modbrowse.bottom.buttons.modfuncs.checkout \
{"Check out selection from the repository"}
set_tooltips .modbrowse.bottom.buttons.modfuncs.export \
{"Export selection from the repository"}
set_tooltips .modbrowse.bottom.buttons.modfuncs.tag \
{"Tag all files in a module"}
set_tooltips .modbrowse.bottom.buttons.modfuncs.branchtag \
{"Branch all files in a module"}
set_tooltips .modbrowse.bottom.buttons.modfuncs.filebrowse \
{"Browse the files in a CVS module"}
set_tooltips .modbrowse.bottom.buttons.svnfuncs.filecat \
{"Show a file in the repository"}
set_tooltips .modbrowse.bottom.buttons.svnfuncs.filelog \
{"Show the history log of a file"}
set_tooltips .modbrowse.bottom.buttons.svnfuncs.remove \
{"Remove something from the SVN repository"}
set_tooltips .modbrowse.bottom.buttons.modfuncs.patchsummary \
{"Show a summary of differences between versions"}
set_tooltips .modbrowse.bottom.buttons.modfuncs.patchfile \
{"Create a patch file"}
set_tooltips .modbrowse.bottom.buttons.cvsfuncs.import \
{"Import the current directory into the repository"}
set_tooltips .modbrowse.bottom.buttons.cvsfuncs.who \
{"Show who has modules checked out"}
set_tooltips .modbrowse.bottom.buttons.cvsfuncs.brefresh \
{"Re-read the modules"}
set_tooltips .modbrowse.bottom.buttons.close \
{"Close the repository browser"}
set_tooltips .modbrowse.top.bworkdir \
{"Open the Working Directory Browser"}
frame .modbrowse.treeframe -bg $colorglb(treebg)
pack .modbrowse.treeframe -side bottom -fill both -expand yes -pady 0
set screenWidth [winfo vrootwidth .]
set screenHeight [winfo vrootheight .]
wm maxsize .modbrowse $screenWidth $screenHeight
wm minsize .modbrowse 430 300
gen_log:log T "LEAVE"
}
# Try to contact the repository somehow to guess what kind it is
proc modbrowse_guess_vcs {} {
global cvsglb
global cvscfg
global modbrowse_module
gen_log:log T "ENTER"
gen_log:log D "cvsglb(root) = $cvsglb(root)"
# If there's no root at all, don't waste our time
if {$cvsglb(root) eq ""} {
gen_log:log D "cvsglb(root) is empty. Not proceeding further."
gen_log:log T "LEAVE ($cvsglb(vcs))"
return $cvsglb(vcs)
}
set vcs ""
set cvs_cmd "cvs -d $cvsglb(root) rdiff -l -s -D 01/01/1971 \"$modbrowse_module\""
gen_log:log C $cvs_cmd
set cvsret [catch {exec {*}$cvs_cmd > $cvscfg(null)} cvsout]
if {[string match {*Diffing*} $cvsout]} {
gen_log:log T "LEAVE (cvs)"
return "cvs"
} else {
gen_log:log E $cvsout
}
set svn_cmd "svn list $cvsglb(root)"
gen_log:log C $svn_cmd
set svnret [catch {exec {*}$svn_cmd} svnout]
if {$svnret} {
gen_log:log E $svnout
} else {
gen_log:log T "LEAVE (svn)"
return "svn"
}
set git_cmd "git ls-remote $cvsglb(root)"
gen_log:log C $git_cmd
set gitret [catch {exec {*}$git_cmd} gitout]
if {$gitret} {
gen_log:log E $gitout
} else {
set cvscfg(gitroot) $cvsglb(root)
gen_log:log T "LEAVE (git)"
return "git"
}
gen_log:log T "LEAVE ($cvsglb(vcs))"
return $cvsglb(vcs)
}
proc modbrowse_run {} {
global env
global incvs insvn inrcs ingit
global cvscfg
global cvsglb
global cvs
global cmd
global cvsroot
global modval
global modtitle
global modbrowse_module
global modbrowse_path
global modbrowse_title
gen_log:log T "ENTER ()"
gen_log:log D "incvs=$incvs insvn=$insvn inrcs=$inrcs ingit=$ingit"
gen_log:log D "cvsglb(root) $cvsglb(root)"
catch {unset modval}
catch {unset modtitle}
set modbrowse_module ""
if {$incvs} {
set cvsglb(vcs) cvs
read_cvs_dir "[pwd]/CVS"
} elseif {$insvn} {
set cvsglb(vcs) svn
read_svn_dir "[pwd]"
set cvsglb(root) $cvscfg(url)
set cvscfg(root) $cvsglb(root)
} elseif {$ingit} {
set cvsglb(vcs) git
read_git_dir "[pwd]"
set cvsglb(root) $cvsglb(repos_top)
} elseif {$inrcs} {
set cvsglb(vcs) rcs
} else {
set cvsglb(vcs) [modbrowse_guess_vcs]
}
gen_log:log D "cvsglb(vcs) $cvsglb(vcs)"
if {! [winfo exists .modbrowse]} {
modbrowse_setup
}
wm deiconify .modbrowse
raise .modbrowse
ModTree:destroy .modbrowse.treeframe
busy_start .modbrowse
switch $cvsglb(vcs) {
svn {
.modbrowse.top.lroot configure -text "SVN URL"
.modbrowse.top.lmcode configure -text "Selection"
# Set up ModTree and tell it to use clbk just-in-time-listdir
ModTree:create .modbrowse.treeframe
pack .modbrowse.treeframe.pw -side bottom -fill both -expand yes
.modbrowse.treeframe.pw heading file -text "File"
.modbrowse.treeframe.pw heading information -text "Date"
.modbrowse.treeframe.pw configure -selectmode extended
# parse_svnmodules will do "svn list" and post the files and directories
bind .modbrowse.treeframe.pw <<TreeviewOpen>> svn_jit_listdir
bind .modbrowse.treeframe.pw <<TreeviewClose>> svn_closedir
bind .modbrowse.treeframe.pw <<TreeviewSelect>> {
global modbrowse_module
global modbrowse_path
global modbrowse_title
set selection [.modbrowse.treeframe.pw selection]
set modbrowse_title [string trimleft $selection "/"]
set modbrowse_path $modbrowse_title
set modbrowse_module $modbrowse_path
}
# parse_svnmodules does svn list of the repository
# For SVN. The URL changes depending on what directory we're in, so if we're
# in an SVN directory, use svnroot instead of cvsglb(root)
if {! [info exists cvscfg(svnroot)]} {
set cvscfg(svnroot) $cvsglb(root)
}
parse_svnmodules $cvscfg(svnroot)
}
cvs {
.modbrowse.top.lroot configure -text "CVSROOT"
.modbrowse.top.lmcode configure -text "Module"
# Set up ModTree
ModTree:create .modbrowse.treeframe
pack .modbrowse.treeframe.pw -side bottom -fill both -expand yes
.modbrowse.treeframe.pw heading file -text "Module"
.modbrowse.treeframe.pw heading information -text "Information"
.modbrowse.treeframe.pw column #0 -width [expr {$cvsglb(mod_iconwidth) * 2}]
.modbrowse.treeframe.pw configure -selectmode extended
bind .modbrowse.treeframe.pw <<TreeviewSelect>> {
global modbrowse_module
global modbrowse_path
global modbrowse_title
set selection [.modbrowse.treeframe.pw selection]
set modbrowse_title [string trimleft $selection "/"]
set modbrowse_path $modbrowse_title
set modbrowse_module $modbrowse_path
}
# parse_cvsmodules will check out CVSROOT/modules and post what it finds
parse_cvsmodules $cvsglb(root)
}
git {
.modbrowse.top.lroot configure -text "Origin"
.modbrowse.top.lmcode configure -text "Selection"
# Set up ModTree for a git ls-remote
ModTree:create .modbrowse.treeframe
pack .modbrowse.treeframe.pw -side bottom -fill both -expand yes
.modbrowse.treeframe.pw heading file -text "Reference"
.modbrowse.treeframe.pw heading information -text "Commit ID"
.modbrowse.treeframe.pw column #0 -width 0
.modbrowse.treeframe.pw configure -selectmode browse
bind .modbrowse.treeframe.pw <<TreeviewSelect>> {
global modbrowse_module
global modbrowse_path
global modbrowse_title
set selection [.modbrowse.treeframe.pw selection]
set modbrowse_title $selection
set modbrowse_path $modbrowse_title
# The hash, not the name
lappend modbrowse_module [lindex [.modbrowse.treeframe.pw item $modbrowse_path -values] 1]
}
# parse_gitlist will do git ls-remote and post what it finds
parse_gitlist $cvsglb(root)
}
rcs {
.modbrowse.top.lroot configure -text "RCS Path"
.modbrowse.top.lmcode configure -text "Selection"
# There's no such thing as a remote RCS repository as far as I know,
# so we can just do a directory listing
ModTree:create .modbrowse.treeframe
pack .modbrowse.treeframe.pw -side bottom -fill both -expand yes
.modbrowse.treeframe.pw heading file -text "File"
.modbrowse.treeframe.pw heading information -text "Date"
.modbrowse.treeframe.pw column #0 -width 0
.modbrowse.treeframe.pw column #2 -width 150
.modbrowse.treeframe.pw column #2 -width 30
.modbrowse.treeframe.pw configure -selectmode browse
bind .modbrowse.treeframe.pw <<TreeviewSelect>> {
global modbrowse_module
global modbrowse_path
global modbrowse_title
set selection [.modbrowse.treeframe.pw selection]
set modbrowse_title $selection
set modbrowse_path $modbrowse_title
#set modbrowse_module $modbrowse_path
set modbrowse_module [lindex [.modbrowse.treeframe.pw item $modbrowse_path -values] 0]
}
find_rcsfiles $cvsglb(root)
}
default {
# Just make an empty frame
ModTree:create .modbrowse.treeframe
pack .modbrowse.treeframe.pw -side bottom -fill both -expand yes
busy_done .modbrowse
return
}
}
busy_done .modbrowse
# Maybe this root is new to us?
picklist_used cvsroot "$cvsglb(root)"
# Have to do this to display the new value in the list
.modbrowse.top.troot configure -values $cvsglb(cvsroot)
# Start without revision-control menu
gen_log:log D "CONFIGURE VCS MENUS"
foreach label {"CVS" "SVN" "GIT" "RCS" "Import"} {
if {! [catch {set vcsmenu_idx [.modbrowse.menubar index "$label"]}]} {
.modbrowse.menubar delete $vcsmenu_idx
}
}
set filemenu_idx [.modbrowse.menubar index "File"]
switch $cvsglb(vcs) {
cvs {
.modbrowse.bottom.buttons.modfuncs.filebrowse configure \
-command { browse_files $modbrowse_module }
.modbrowse.bottom.buttons.modfuncs.checkout configure -state normal \
-command { dialog_cvs_checkout $cvscfg(cvsroot) $modbrowse_module }
.modbrowse.bottom.buttons.cvsfuncs.import configure -state normal \
-command { cvs_import_setup }
.modbrowse.bottom.buttons.modfuncs.checkout configure -state normal \
-command { dialog_cvs_checkout $cvscfg(cvsroot) $modbrowse_module }
.modbrowse.bottom.buttons.modfuncs.export configure -state normal \
-command { dialog_cvs_export $cvscfg(cvsroot) $modbrowse_module }
.modbrowse.bottom.buttons.modfuncs.tag configure -state normal \
-command { rtag_dialog $cvscfg(cvsroot) $modbrowse_module "tag" }
.modbrowse.bottom.buttons.modfuncs.branchtag configure -state normal \
-command { rtag_dialog $cvscfg(cvsroot) $modbrowse_module "branch" }
.modbrowse.bottom.buttons.modfuncs.patchsummary configure -state normal \
-command { dialog_cvs_patch $cvscfg(cvsroot) $modbrowse_module 1 }
.modbrowse.bottom.buttons.modfuncs.patchfile configure -state normal \
-command { dialog_cvs_patch $cvscfg(cvsroot) $modbrowse_module 0 }
.modbrowse.bottom.buttons.cvsfuncs.who configure -state normal
.modbrowse.bottom.buttons.svnfuncs.filecat configure -state disabled
.modbrowse.bottom.buttons.svnfuncs.filelog configure -state disabled
.modbrowse.bottom.buttons.svnfuncs.remove configure -state disabled
.modbrowse.menubar insert [expr {$filemenu_idx + 1}] cascade -label "CVS" \
-menu .modbrowse.menubar.cvs
}
svn {
.modbrowse.bottom.buttons.cvsfuncs.import configure -state normal \
-command { svn_import_run }
.modbrowse.bottom.buttons.modfuncs.filebrowse configure -state disabled
.modbrowse.bottom.buttons.modfuncs.checkout configure -state normal \
-command { dialog_svn_checkout $cvscfg(svnroot) $modbrowse_path checkout}
.modbrowse.bottom.buttons.modfuncs.export configure -state normal \
-command { dialog_svn_checkout $cvscfg(svnroot) $modbrowse_path export}
.modbrowse.bottom.buttons.modfuncs.tag configure -state normal \
-command { dialog_svn_tag $cvscfg(svnroot) $modbrowse_path "tags" }
.modbrowse.bottom.buttons.modfuncs.branchtag configure -state normal \
-command { dialog_svn_tag $cvscfg(svnroot) $modbrowse_path "branches" }
.modbrowse.bottom.buttons.modfuncs.patchsummary configure -state normal \
-command { dialog_svn_patch $cvscfg(svnroot) $modbrowse_path {} 1 }
.modbrowse.bottom.buttons.modfuncs.patchfile configure -state normal \
-command { dialog_svn_patch $cvscfg(svnroot) $modbrowse_path {} 0 }
.modbrowse.bottom.buttons.cvsfuncs.who configure -state disabled
.modbrowse.bottom.buttons.svnfuncs.filecat configure -state normal
.modbrowse.bottom.buttons.svnfuncs.filelog configure -state normal
.modbrowse.bottom.buttons.svnfuncs.remove configure -state normal
.modbrowse.menubar insert [expr {$filemenu_idx + 1}] cascade -label "SVN" \
-menu .modbrowse.menubar.svn
}
git {
# Disable all except clone
.modbrowse.bottom.buttons.cvsfuncs.import configure -state disabled
.modbrowse.bottom.buttons.modfuncs.filebrowse configure -state disabled
.modbrowse.bottom.buttons.modfuncs.checkout configure -state normal \
-command { dialog_git_clone $cvscfg(gitroot) $modbrowse_module }
.modbrowse.bottom.buttons.modfuncs.export configure -state disabled
.modbrowse.bottom.buttons.modfuncs.tag configure -state disabled
.modbrowse.bottom.buttons.modfuncs.branchtag configure -state disabled
.modbrowse.bottom.buttons.modfuncs.patchsummary configure -state disabled
.modbrowse.bottom.buttons.modfuncs.patchfile configure -state disabled
.modbrowse.bottom.buttons.cvsfuncs.who configure -state disabled
.modbrowse.bottom.buttons.svnfuncs.filecat configure -state disabled
.modbrowse.bottom.buttons.svnfuncs.filelog configure -state disabled
.modbrowse.bottom.buttons.svnfuncs.remove configure -state disabled
.modbrowse.menubar insert [expr {$filemenu_idx + 1}] cascade -label "GIT" \
-menu .modbrowse.menubar.git
}
rcs {
# Disable all except fileview and filelog
.modbrowse.bottom.buttons.cvsfuncs.import configure -state disabled
.modbrowse.bottom.buttons.modfuncs.filebrowse configure -state disabled
.modbrowse.bottom.buttons.modfuncs.checkout configure -state disabled
.modbrowse.bottom.buttons.modfuncs.export configure -state disabled
.modbrowse.bottom.buttons.modfuncs.tag configure -state disabled
.modbrowse.bottom.buttons.modfuncs.branchtag configure -state disabled
.modbrowse.bottom.buttons.modfuncs.patchsummary configure -state disabled
.modbrowse.bottom.buttons.modfuncs.patchfile configure -state disabled
.modbrowse.bottom.buttons.cvsfuncs.who configure -state disabled
.modbrowse.bottom.buttons.svnfuncs.filecat configure -state normal \
-command { rcs_fileview_checkout . "$modbrowse_module" }
.modbrowse.bottom.buttons.svnfuncs.filelog configure -state normal \
-command { rcs_log verbose "$modbrowse_module" }
.modbrowse.bottom.buttons.svnfuncs.remove configure -state disabled
}
default {
# Disable all
.modbrowse.bottom.buttons.cvsfuncs.import configure -state disabled
.modbrowse.bottom.buttons.modfuncs.filebrowse configure -state disabled
.modbrowse.bottom.buttons.modfuncs.checkout configure -state disabled
.modbrowse.bottom.buttons.modfuncs.export configure -state disabled
.modbrowse.bottom.buttons.modfuncs.tag configure -state disabled
.modbrowse.bottom.buttons.modfuncs.branchtag configure -state disabled
.modbrowse.bottom.buttons.modfuncs.patchsummary configure -state disabled
.modbrowse.bottom.buttons.modfuncs.patchfile configure -state disabled
.modbrowse.bottom.buttons.cvsfuncs.who configure -state disabled
.modbrowse.bottom.buttons.svnfuncs.filecat configure -state disabled
.modbrowse.bottom.buttons.svnfuncs.filelog configure -state disabled
.modbrowse.bottom.buttons.svnfuncs.remove configure -state disabled
}
}
if {$insvn || $incvs || $inrcs || $ingit} {
# Don't allow an attempt to import from a version-controlled directory
.modbrowse.bottom.buttons.cvsfuncs.import configure -state disabled
}
# Populate the tree
switch $cvsglb(vcs) {
svn {
# Make sure branches and tags names come first, before any of their
# contents, so we get the "# tags" and "# branches" labels
set newlist ""
foreach item [array names modval] {
if {! ($item == $cvscfg(svn_branchdir) || $item == $cvscfg(svn_tagdir))} {
lappend newlist $item
}
}
set newlist [lsort $newlist]
set newlist [concat {$cvscfg(svn_branchdir} {$cvscfg(svn_tagdir)} $newlist]
}
cvs {
cvs_modbrowse_tree [lsort [array names modval]] "/"
}
git {
# Nothing to do here
}
}
busy_done .modbrowse
gen_log:log T "LEAVE"
}
proc module_exit { } {
global cvscfg
global cvs
global cmd
gen_log:log T "ENTER"
# Stop any checkout that may be in process
if {[info exists cmd(cvs_co)]} {
catch {$cmd(cvs_co)\::abort}
catch {unset cmd(cvs_co)}
}
set pid [pid]
set cwd [pwd]
set sandbox [file join $cvscfg(tmpdir) cvstmpdir.$pid]
if {[file isdirectory $sandbox]} {
gen_log:log F "CD $sandbox"
cd $sandbox
set dirs {}
foreach d [glob -nocomplain *] {
lappend dirs $d
}
gen_log:log C "$cvs -Q release $dirs"
catch {exec {*}$cvs -Q release $dirs}
# Doing it this way makes it pop up an error on windows.
# Very annoying.
#set finish [exec::new "$cvs -Q release $dirs"]
#$finish\::wait
}
cd $cwd
gen_log:log F "CD [pwd]"
set cvscfg(modgeom) [wm geometry .modbrowse]
ModTree:destroy .modbrowse.modtree
destroy .modbrowse
catch {destroy .tooltips_wind}
exit_cleanup 0
gen_log:log T "LEAVE"
}
proc ModTree:create {w} {
global cvsglb
global cvscfg
ttk::treeview $w.pw -yscrollcommand "$w.yscroll set"
$w.pw configure -columns "file information"
$w.pw column #0 -minwidth 0
$w.pw column #0 -width $cvsglb(mod_iconwidth)
$w.pw column #0 -stretch no
ttk::scrollbar $w.yscroll -orient vertical \
-command "$w.pw yview"
pack $w.yscroll -side right -fill y
focus $w.pw
}
proc ModTree:destroy {w} {
destroy $w.pw
destroy $w.yscroll
}