Forum OpenACS Q&A: Response to SDM: Assigning a patch to a Bug and/or Feature

Have you tested the "Apply patch and close BAFs" feature to make sure it applies the patch correctly or is able to handle errors?

Yes, I have. The only problem I have is the fact that I don't have the CVS set up correctly, so the CVS specific things fail (nicely, though). The only lines I added to patch-accept.tcl are:
Near the beginning:

if {![info exists bafset]} { set bafset "" }
Which prevents the next piece of code from failing, which I put after everything else (but before return-template):
set bafs [split $bafset]
foreach baf_id $bafs {

    if { $baf_id != 0 && $baf_id != "" } {
        ns_db dml $db "update bugs_and_features set baf_status='3',
completion=(select package_release_id from sdm_package_patches where
baf_id='$baf_id' and patch_id='$patch_id') where baf_id='$baf_id'"

    }
}
There are still some issues I have to resolve before my changes are ready for prime-time, this is one of them: The code above closes the BAFs with the release_id as it is specified in the patch record (the subselect). You should either be able to change the release number for the patch before accepting, updating the patch record (!= possible now) or there should be a way to specify it at 'accept and close BAFs' time. I would prefer the first option, BTW.

My selfish question: have you tested this with 3.2.5 from CVS?
I developed it in 3.2.5 from CVS, although the live demo is running in 3.2.4 (with all SDM files from 3.2.5, obviously).

I found and fixed some other things too, mostly in getting the current user_id. There is one disturbing thing in acs3-pg/tcl/sdm-defs.tcl where the proc sdm_check_admin does this:


    ## HACK TO LET BEN SEE EVERYTHING FOR NOW

    if {$user_id == 4} {
          return 1
Since you have a db handle available there, it must be possible to use a hard-coded email address instead of user_id. Shall I fix that? In that same file, there is a hard coded link to a file in the filesystem:
proc sdm_code_license {} {
    set file [open "/web/aol-dev/www/license.html" r]
This patch has one 'flaw': you cannot assign a patch directly to a module without a BAF. I think it would be great if you could go to a module, click on 'I have a patch for this module' and then go to a submit patch form that will create a BAF record while storing the patch.