Search code examples
versioningibm-doorsbaseline

Why does DOORS `isBaseline` seem to always return FALSE?


I created a new major baseline in a DOORS module and then ran a small DXL script which includes lines

 Module mp = current
Baseline bp = getMostRecentBaseline(mp)
int majorVersion = major(bp)
int minorVersion = minor(bp)
print "major " majorVersion " minor " minorVersion "\n"
string suff = suffix(bp)
print "suffix " suff "\n"
bool bstat
bstat = isBaseline(mp)
print "bstat " bstat "\n"
ModuleVersion mv = moduleVersion(mp)
string basind = baselineIndex(mp)
print "baseline index " basind "\n"
bool otherbstat = baseline(mp)
print "otherstat " otherbstat "\n"
bool basv = isBaseline(mv)
print "version base " basv "\n"  

All of these return FALSE, indicating the module is not currently baselined. I have not done any edits to any attributes since baselining. I have done things like creating new Views. If I run the IBM DXL macro to compare the latest baseline against the "Current" version, it reports there are zero differences.

So my question is - what do the various isBaseline functions look at that is causing them to return FALSE? Or, am I going about this the wrong way - all I really need is a Q&D bit of DXL code to check that my module hasn't been edited for content since the last baseline was established.


Solution

  • The primary issue is that when your code gets a ModuleVersion (line 11), it uses a form of the function that gets the current version of the module. Line 14 should invoke isBaseline, not baseline, making the last two lines redundant.

    See p310 of the current version (9.6.1) of the DXL Reference Manual for full details of the moduleVersion function.

    The minimally modified version of your code that gets the result I think you were expecting, follows:

    Module mp = current
    Baseline bp = getMostRecentBaseline(mp)
    int majorVersion = major(bp)
    int minorVersion = minor(bp)
    print "major " majorVersion " minor " minorVersion "\n"
    string suff = suffix(bp)
    print "suffix " suff "\n"
    bool bstat
    bstat = isBaseline(mp)
    print "bstat " bstat "\n"
    ModuleVersion mv = moduleVersion(uniqueID(mp), bp)
    string basind = baselineIndex(mp)
    print "baseline index " basind "\n"
    bool otherbstat = isBaseline(mv)
    print "otherstat " otherbstat "\n"
    bool basv = isBaseline(mv)
    print "version base " basv "\n"  
    

    In the version below, I've renamed variables, reordered some lines, and removed some content that wasn't required, for clarity:

    Module modCurrent   = current
    Baseline blLatest   = getMostRecentBaseline(modCurrent)
    
    int iMajorVersion   = major(blLatest)
    int iMinorVersion   = minor(blLatest)
    
    string sBLSuffix    = suffix(blLatest)
    
    print "last baseline: major " iMajorVersion " minor " iMinorVersion " suffix " sBLSuffix "\n"
    
    bool bIsBaseline = isBaseline(modCurrent)
    
    print "bIsBaseline = " bIsBaseline "\n"
    
    ModuleVersion mv    = moduleVersion(uniqueID(modCurrent), blLatest)
    Module modBaselined = load(mv, false)
    
    string basind = baselineIndex(modBaselined)
    
    print "baseline index = " basind "\n"
    
    bIsBaseline = isBaseline(modBaselined)
    
    print "bIsBaseline = " bIsBaseline "\n"
    
    close(modBaselined)