Compare and update two directories\namespaces for class files
Hi,
I would like to know if there is any code to compare and update two directories/namespaces for class files.
If file is present in directory1 and not present in diectory2, it should import the classfile.
If file is not present in directory1 and it is present in directory2, the corresponding file should be deleted from directory2.
Please suggest code for the task.
Thanks,
Arpitha R
Have you considered implementing a Caché source code management tool such as Deltanji from George James Software, for whom I work? A Deltanji workflow can propagate code from one namespace to another, and can also propagate deletions. In other words, if you decommission a class in DEV, then propagate the now-decommissioned code object to TEST, the class will be deleted from TEST.
- If the two directories should have the same classes, you could use class mapping to point the two namespaces to the same code base ...
Beside getting a source code tool, there are several ways to compare :
- If you want to write your own compare logic, you can use the %Dictionary.* classes (a lot of work, since there are a lot of classes /properties to compare). Use this to get a list of classes in the two directories and to see which is missing.
- If you want to compare two classes quick-and-dirty : you can have a look at the global ^oddDEF. It contains the class definition of all classes : methods, properties, indexes, storage etc. are all in this global. You could $ZOrder your way through the global and compare the two namespaces. But since this is internal stuff, it could change in new versions of Caché!
Here is an example, but test before you use it !!!