SVN (Subversion) Update

Run an SVN update of code from Igor on Windows using TortoiseSVN. This is complicated by the fact that Independent modules are not handled gracefully and that closing procedure windows while procedures are running can confuse Igor if not done correctly.

Function SVNUpdate()
    DoAlert 1,"Close all procedure files, update, and reload them?  Unsaved changes to procedure files will be lost."
    Variable i
    if(V_flag==1)      
                String cmdList=CloseAllProcs(exec=0); // Generate a list of procedure closing commands.  For some reason directly executing CloseAllProcs(exec=1) in the execute queue doesn't work correctly.  
        for(i=0;i<ItemsInList(cmdList);i+=1)
            String cmd=StringFromList(i,cmdList)
            Execute /Q/P cmd // Execute each procedure closing.  
        endfor
        cmd="TortoiseProc /command:update /path:"
        String codePath="C:Documents and Settings:rick:Application Data:Wavemetrics:Igor Pro 6:Packages:Code"
        NewPath /O/Q CodePath, codePath
        Execute /Q/P "ExecuteScriptText /B/Z \""+cmd+"\\\""+codePath+"\\\"\"" // Run the SVN update.  Extra slashes needed to escape the quotes in the command.  
        Execute /Q/P "OpenProc /P=CodePath /V=1 \"Master.ipf\"" // Assume that master.ipf will #include the other procedure files.  
        Execute /Q/P "Silent 101" // Recompile.  
    endif
End

Function /S CloseAllProcs([except,exec])
    String except
    Variable exec
   
    if(ParamIsDefault(except))
        except=""
    endif
    exec=ParamIsDefault(exec) ? 1 : exec
    Execute /Q "SetIgorOption IndependentModuleDev=1"
    String currProcs=WinList("*",";","WIN:128,INDEPENDENTMODULE:1")
    Variable i=0
    String cmdList=""
    for(i=0;i<ItemsInList(currProcs);i+=1)
        String procName=StringFromList(i,currProcs)
        Variable pos=strsearch(procName,"[",0)
        if(pos>=0) // If this has an independent module name.
            procName=procName[0,pos-2]// Truncate it to be compatible with CloseProc.  
        endif
        if(WhichListItem(except,procName)>=0)
            continue // Do not close procedures on the except list.  
        endif
        if(StringMatch(procName,"Procedure"))
            continue // Do not close experiment procedure file.  
        endif
       
        String cmd
        sprintf cmd, "CloseProc /NAME=\"%s\"",procName
        if(exec)
            Execute /Q/P cmd
        endif
        cmdList+=cmd+";"
    endfor
    Execute /Q "SetIgorOption independentModuleDev=0"
    if(exec)
        Execute /Q/P "Silent 101"
    endif
    return cmdList
End

Forum

Support

Gallery

Igor Pro 8

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More