Merging changes from one development environment into another is done by exporting the changes from the first (i.e., source) environment using ZOMExport and then importing these changed objects into the second (i.e., target) environment using ZOMImport. The import process compares the incoming objects from the source environment with the objects in the target environment. New objects are created in the target environment. Changed objects are reflected in the target environment, taking into account any existing objects and dependencies with other objects.
Returning to the master-slave development example, assume that Steve is to merge his changes into the master environment first. Also, assume Steve has ZOM configured with the default new keyword, “$new”, and the default changed keyword, “$changed”. These two keywords then identify all new and changed objects in his development environment. These are the objects to be merged into the master environment.
Note: There are several variations of how ZOMExport and ZOMImport can work together. This is the most basic.
Note: ZOMExport and ZOMImport always save/load definitions to/from a directory called port beneath the DB directory.
To merge, Steve performs the following steps:
- Extract the new and changed objects from the slave environment using the ZOMExport command and the new keyword and changed keyword:
ZOMExport + k $new,$changed
The “+k $new” selects all new objects, while the “+k $changed” selects all changed objects. These objects are exported in the normal manner by ZOMExport. Thus, in Steve’s case, the two forms he changed, fEmpl and fCorp, and the new form he created, fProj, are exported.
Now, Steve should remove the new and changed keywords. In this way, the next time, Steve exports only objects created or changed since the last time he exported.
ZOMSet +k $new,$changed ;k$new! ;k$changed!
- Move the files containing the exported objects to the master environment.
ZOMExport creates a series of files whose names are suffixed with “.z50”. To move the objects from Steve’s environment to the master environment, first delete any files with the “.z50” suffix from the master environment, then copy the “.z50” files from Steve’s directory to the master environment.
For example, if Steve is working with Windows, Novell, or MS-Net and his development environment is stored in the directory C:ZimAPPSTEVE and the master environment is store in the directory C:ZimAPPMASTER, then Steve would execute the following commands:
copy c:zimappsteveport*.z50 c:zimappmasterport
Under similar circumstances in a UNIX environment, Steve would execute:
cp /zimapp/steve/port/*.z50 /zimapp/master
- Import the objects from the slave environment into the master environment by invoke the ZOMImport command in the master environment:
ZOMImport imports the objects from the files produced by ZOMExport. These objects are loaded into the Object Dictionary and created.
The process can be repeated for Carol.
If Steve and Carol have been working on different parts of the system, their changes merge into the master environment without conflict. If, on the other hand, there are conflicting changes, then some of Carol’s updates can overwrite Steve’s. If there is the potential for conflict, there are a number of ways to control or prevent trouble using ZOM. The most straightforward methods involve use of keywords and locks.
Note: The master-slave development scenario includes the situation where the master environment represents the current “production” application and the slave environments represent ongoing developments. This scenario also applies to single person projects as well.