In an attempt to help another user who posted a query on the General Discussion forum, the code snippet below was meant to load a specific module baseline and then copy it. It does not work as desired - it only ever copies the current version.
I assumed that the code line "bas = load(m, baseline(basMaj, basMin, basSuffix), true)" would provide a handle to the module baseline but it deceives the mind because it doesn't, it just gives a handle to the current version. I spent 2 nanoseconds asking why then I remembered Louie's advice to be a 3 year old and just accept DXL the way it is!!
But I can't let go - is there a way to get a handle to a selected module baseline and use the DXL copy(module) function to create a copy? The DOORS built-in module menu function Baseline > Copy seems to mimic a copy by building a clone of the baseline (not a true copy-n-paste), so I'm not confident that this can be done with the DXL copy(module) function but alas, I have been surprised before.
Module m = current
Module bas
ModName_ modName = module(fullName(m))
ModName_ basName
int basMaj = 2
int basMin = 0
string basSuffix = "Post RBR"
downgrade m //set m to read-only to remove edit lock which will prevent a copy
bas = load(m, baseline(basMaj, basMin, basSuffix), true)
basName = module(fullName(bas))
copy(basName,"Baseline copy","")
Paul Miller
Melbourne, Australia
SystemAdmin - Tue Mar 22 01:05:50 EDT 2011 |
|
Re: Copy a Baseline from one Module to another Module Mathias Mamsch - Tue Mar 22 05:26:28 EDT 2011
I don't think that can be done. I always think of a "Module" as a container for "ModuleVersion"s. The DOORS copy/paste will copy the container, but only the current version. Unfortunately a "Make a new Container from a ModuleVersion" does not exist, probably because there is some data in the container only. The next thing is, that as soon as you baseline DOORS will remove stuff like the absno.dtc (which indicates the next absolute number) from the moduleversion. Therefore a make a new module from a baseline would need to be creative in restoring this stuff (e.g. what next absolute number should be given). So that is probably the reason why this is not implemented.
Oh by the way - the load(Module, Baseline, bool) does give you a handle to the baseline. What else would it do?
Regards, Mathias
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
|
Re: Copy a Baseline from one Module to another Module Peter_Albert - Tue Mar 22 05:49:09 EDT 2011 Mathias Mamsch - Tue Mar 22 05:26:28 EDT 2011
I don't think that can be done. I always think of a "Module" as a container for "ModuleVersion"s. The DOORS copy/paste will copy the container, but only the current version. Unfortunately a "Make a new Container from a ModuleVersion" does not exist, probably because there is some data in the container only. The next thing is, that as soon as you baseline DOORS will remove stuff like the absno.dtc (which indicates the next absolute number) from the moduleversion. Therefore a make a new module from a baseline would need to be creative in restoring this stuff (e.g. what next absolute number should be given). So that is probably the reason why this is not implemented.
Oh by the way - the load(Module, Baseline, bool) does give you a handle to the baseline. What else would it do?
Regards, Mathias
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
(My apologies for splitting this post, but I always get "Disallowed content detected", and I have no idea where it comes from)
Part 1
One problem with the original code is that "copy" expects a "ModName_" variable as input; however, the "basName = module(fullName(bas))" returns a handle to the current Module, so it is obvious that in the OP "copy" copies the current Module.
|
|
Re: Copy a Baseline from one Module to another Module Peter_Albert - Tue Mar 22 05:49:50 EDT 2011 Peter_Albert - Tue Mar 22 05:49:09 EDT 2011
(My apologies for splitting this post, but I always get "Disallowed content detected", and I have no idea where it comes from)
Part 1
One problem with the original code is that "copy" expects a "ModName_" variable as input; however, the "basName = module(fullName(bas))" returns a handle to the current Module, so it is obvious that in the OP "copy" copies the current Module.
(Part 2)
With the following code I tried to get a "ModName_" handle on a baseline:
Module currMod = current Module
ModName_ currModName_ = module(fullName currMod)
Baseline b = baseline(0,1,"")
ModuleVersion baseModVer = moduleVersion(currModName_, b)
ModName_ baseModName_ = module(baseModVer)
|
|
Re: Copy a Baseline from one Module to another Module Peter_Albert - Tue Mar 22 05:51:17 EDT 2011 Peter_Albert - Tue Mar 22 05:49:50 EDT 2011
(Part 2)
With the following code I tried to get a "ModName_" handle on a baseline:
Module currMod = current Module
ModName_ currModName_ = module(fullName currMod)
Baseline b = baseline(0,1,"")
ModuleVersion baseModVer = moduleVersion(currModName_, b)
ModName_ baseModName_ = module(baseModVer)
(Part 3)
but it seems to me that "ModuleVersion moduleVersion(ModName_ modRef,Baseline b)" does not do what it pretends to do, as copy, called with "baseModName_" still copies the current Module.
|
|
Re: Copy a Baseline from one Module to another Module Peter_Albert - Tue Mar 22 05:51:49 EDT 2011 Peter_Albert - Tue Mar 22 05:51:17 EDT 2011
(Part 3)
but it seems to me that "ModuleVersion moduleVersion(ModName_ modRef,Baseline b)" does not do what it pretends to do, as copy, called with "baseModName_" still copies the current Module.
(Part 4)
In addition,
print (baseModName_ == currModName_) "\n"
returns "true",
|
|
Re: Copy a Baseline from one Module to another Module Peter_Albert - Tue Mar 22 05:52:19 EDT 2011 Peter_Albert - Tue Mar 22 05:51:49 EDT 2011
(Part 4)
In addition,
print (baseModName_ == currModName_) "\n"
returns "true",
(Part 5)
and
print (open baseModName_) "\n"
also returns "true",
|
|
Re: Copy a Baseline from one Module to another Module Peter_Albert - Tue Mar 22 05:52:43 EDT 2011 Peter_Albert - Tue Mar 22 05:52:19 EDT 2011
(Part 5)
and
print (open baseModName_) "\n"
also returns "true",
(Part 6)
even when the baseline is not open.
|
|
Re: Copy a Baseline from one Module to another Module Peter_Albert - Tue Mar 22 05:54:48 EDT 2011 Peter_Albert - Tue Mar 22 05:52:43 EDT 2011
(Part 6)
even when the baseline is not open.
(Part 7)
,verified through the "Manage open module" dialogue bo x.
|
|
Re: Copy a Baseline from one Module to another Module Peter_Albert - Tue Mar 22 05:55:59 EDT 2011 Peter_Albert - Tue Mar 22 05:54:48 EDT 2011
(Part 7)
,verified through the "Manage open module" dialogue bo x.
(Part 8)
Now, please could somebody tell me why "verified through the "Manage open module" dialogue bo x." without the empty space in "bo x" is disallowed content?
Anyhow, I'd say, you cannot get a "ModName_" handle to a baseline, and you cannot use "copy" for copying as baseline.
Regards,
Peter
|
|
Re: Copy a Baseline from one Module to another Module Mathias Mamsch - Tue Mar 22 06:54:25 EDT 2011 Peter_Albert - Tue Mar 22 05:55:59 EDT 2011
(Part 8)
Now, please could somebody tell me why "verified through the "Manage open module" dialogue bo x." without the empty space in "bo x" is disallowed content?
Anyhow, I'd say, you cannot get a "ModName_" handle to a baseline, and you cannot use "copy" for copying as baseline.
Regards,
Peter
Hmm that is pretty strange with the "dialogue b0x". Does not work for me either. B0x seems to be a "bad word"? :-) Anyway lets clear this up:
-
ModName_ is nothing more than a "name of a module", a container which can have serveral ModuleVersions and always has a current ModuleVersion. The term "opening a module" is technically speaking wrong, you always open a ModuleVersion which resides in its container, the module.
-
A "Module" in DXL is an opened ModuleVersion, not to be confused with the Module Container like in (Archive Module).
-
The module (ModuleVersion) function will give you the Module (container) for the ModuleVersion
-
the load(Module, Baseline, bool) is the same as load(moduleVersion(ModName_, Baseline), bool) and will return an opened ModuleVersion "Module" handle to the specified ModuleVersion, not the current version.
-
copy (..) takes a Module Container as a parameter, not a ModuleVersion. Therefore it will always copy the container, not one specific version. It does that by creating a new container, and copying the Current ModuleVersion of the source container to it. It is hardwired to do this and therefore cannot be used to copy a baseline.
Regards, Mathias
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
|
Re: Copy a Baseline from one Module to another Module SystemAdmin - Tue Mar 22 07:44:22 EDT 2011 Mathias Mamsch - Tue Mar 22 06:54:25 EDT 2011
Hmm that is pretty strange with the "dialogue b0x". Does not work for me either. B0x seems to be a "bad word"? :-) Anyway lets clear this up:
-
ModName_ is nothing more than a "name of a module", a container which can have serveral ModuleVersions and always has a current ModuleVersion. The term "opening a module" is technically speaking wrong, you always open a ModuleVersion which resides in its container, the module.
-
A "Module" in DXL is an opened ModuleVersion, not to be confused with the Module Container like in (Archive Module).
-
The module (ModuleVersion) function will give you the Module (container) for the ModuleVersion
-
the load(Module, Baseline, bool) is the same as load(moduleVersion(ModName_, Baseline), bool) and will return an opened ModuleVersion "Module" handle to the specified ModuleVersion, not the current version.
-
copy (..) takes a Module Container as a parameter, not a ModuleVersion. Therefore it will always copy the container, not one specific version. It does that by creating a new container, and copying the Current ModuleVersion of the source container to it. It is hardwired to do this and therefore cannot be used to copy a baseline.
Regards, Mathias
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
Great explanation Mathias - I got a lot out of that, there is always something new to learn
Paul Miller
Melbourne, Australia
|
|