public class MergeMain extends RootModuleVersionJobAbstractImpl
The principle of operation of this class is to traverse reference graphs in the
standard way using a List of root ModuleVersion's and a
ReferencePathMatcher to identify static source ModuleVersion's to merge
into some destination Version's specified by the user. Only
Module's known to Dragom are considered.
Generally the ReferencePathMatcher will be such that all ModuleVersion's in the reference graph under a root ModuleVersion are to be merged but the generic use of a ReferencePathMatcher allows to be selective about exactly which ModuleVersion's and reference graph subsets are to be merged.
There are actually two types of merge operations supported by Dragom. The
most common one is implemented by MergeReferenceGraph. This class
implements the other one.
The type of merge performed by this class is used, for example, after a release has been performed when it is required to merge changes made to ModuleVersion's into their corresponding main dynamic Version's.
For each static source ModuleVersion that is matched in the main traversal, a merge process is initiated into a dynamic destination ModuleVersion that is specified externally (by the user) and that is not necessarily related to some reference graph. Specifically a destination ModuleVersion is not necessarily referenced by some previous parent destination ModuleVersion that may have been merged into previously during the traversal.
The source ModuleVersion must be static. Non-static ModuleVersion's are ignored, even if matched by the ReferncePathMatcher.
The destination ModuleVersion must be in a user workspace directory so that if merge conflicts are encountered, the user has a workspace where they can be resolved. If a destination ModuleVersion is not in a user workspace directory, it is checked out for the user.
The fact that the destination ModuleVersion must be in a user workspace directory makes this class behave somewhat differently from others in that generally the ModuleVersion's that are in user workspace directories are those that are matched by the root ModuleVersion's and the ReferencePathMatcher, whereas here, those matched ModuleVersion are the source of the merge process and externally specified destination ModuleVersions are in user workspace directories. For that reason, it is generally expected that when this class is invoked, the workspace is empty, source ModuleVersion's are checked out in system workspace directories and destination ModuleVersion's are checked out during the process in user workspace directories. When checking out a destination ModuleVersion in a user workspace directory, no special handling is performed and if another Version of the same Module is already checked out in a user workspace directory and the workspace does not support having multiple Version's of the same Module in user workspace directories, an RuntimeExceptionUserError will likely be raised.
The actual merges on the ModuleVersion's are performed using
ScmPlugin.merge(java.nio.file.Path, org.azyva.dragom.model.Version, java.lang.String), ignoring commits that simply change the
ArtifactVersion of the source Module. These commits are recognized with the
commit attribute "dragom-version-change". Commits that change the Version of
its references are not excluded, as they are with MergeReferenceGraph. The idea
is that we are not merging a reference graph into another reference graph. We
are merging ModuleVersion's in a source reference graph into individual
destination Version's, and changes in reference Version's, which are
necessarily static since the source ModuleVersion is static, are part of the
changes to be merged. This is also why contrary to MergeReferenceGraph, the
children of a merged ModuleVersion are not given any special treatment, other
than being naturally matched by the ReferencePathMatcher during traversal.
RootModuleVersionJobAbstractImpl.UnsyncChangesBehaviorindAvoidReentry, indDepthFirst, indHandleDynamicVersion, indHandleStaticVersion, indListModuleVersionRootChanged, listActionsPerformed, listModuleVersionRoot, moduleReentryAvoider, MSG_PATTERN_KEY_ACTIONS_PERFORMED, MSG_PATTERN_KEY_CANNOT_PROCEED_WITH_UNSYNC_LOCAL_CHANGES, MSG_PATTERN_KEY_CONFLICTS_WHILE_UPDATING, MSG_PATTERN_KEY_DO_YOU_WANT_TO_UPDATE_UNSYNC_REMOTE_CHANGES, MSG_PATTERN_KEY_INITIATING_TRAVERSAL_REFERENCE_GRAPH_ROOT_MODULE_VERSION, MSG_PATTERN_KEY_MODULE_VERSION_ALREADY_PROCESSED, MSG_PATTERN_KEY_MULTIPLE_WORKSPACE_DIRECTORIES_FOR_MODULE, MSG_PATTERN_KEY_NO_ACTIONS_PERFORMED, MSG_PATTERN_KEY_ROOT_MODULE_VERSION_NOT_KNOWN, MSG_PATTERN_KEY_TRAVERSAL_REFERENCE_GRAPH_ROOT_MODULE_VERSION_COMPLETED, MSG_PATTERN_KEY_UPDATE_CHANGED_ROOT_MODULE_VERSION, MSG_PATTERN_KEY_UPDATE_ROOT_MODULE_VERSION_TO_DEFAULT, MSG_PATTERN_KEY_UPDATE_ROOT_MODULE_VERSION_TO_WORKSPACE_DIRECTORY_VERSION, MSG_PATTERN_KEY_UPDATING, MSG_PATTERN_KEY_VERSION_DOES_NOT_EXIST, MSG_PATTERN_KEY_VISITING_LEAF_MODULE_VERSION, MSG_PATTERN_KEY_VISITING_LEAF_REFERENCE_MATCHED, referencePath, RUNTIME_PROPERTY_PROJECT_CODE, RUNTIME_PROPERTY_SYNC_WORKSPACE_DIR, unsyncChangesBehaviorLocal, unsyncChangesBehaviorRemote| Constructor and Description |
|---|
MergeMain(List<org.azyva.dragom.model.ModuleVersion> listModuleVersionRoot)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
visitMatchedModuleVersion(org.azyva.dragom.reference.Reference reference)
Visits a matched
ModuleVersion in the context of traversing the
ReferencePath for performing a merge. |
afterIterateListModuleVersionRoot, beforeIterateListModuleVersionRoot, beforeValidateListModuleVersionRoot, getProjectCode, getReferencePathMatcher, isListModuleVersionRootChanged, iterateListModuleVersionRoot, performJob, setIndAvoidReentry, setIndDepthFirst, setIndHandleDynamicVersion, setIndHandleStaticVersion, setIndListModuleVersionRootChanged, setReferencePathMatcherProvided, setUnsyncChangesBehaviorLocal, setUnsyncChangesBehaviorRemote, setupReferencePathMatcherForProjectCode, validateListModuleVersionRoot, visitModuleVersionpublic MergeMain(List<org.azyva.dragom.model.ModuleVersion> listModuleVersionRoot)
listModuleVersionRoot - List of root ModuleVersion's within which new
static Version's must be created.protected boolean visitMatchedModuleVersion(org.azyva.dragom.reference.Reference reference)
ModuleVersion in the context of traversing the
ReferencePath for performing a merge. The Version of the module must be
static.visitMatchedModuleVersion in class RootModuleVersionJobAbstractImplreference - Reference to the matched ModuleVersion for which a merge
has to be performed.Copyright © 2015–2016 AZYVA INC.. All rights reserved.