Package org.tmatesoft.svn.core.wc2
Class SvnMerge
- java.lang.Object
-
- org.tmatesoft.svn.core.wc2.SvnOperation<java.lang.Void>
-
- org.tmatesoft.svn.core.wc2.SvnMerge
-
- All Implemented Interfaces:
ISvnOperationOptionsProvider
public class SvnMerge extends SvnOperation<java.lang.Void>
Represents merge operation. There are three possible cases of merge operation. If revision ranges (ranges) are provided, merges the changes betweensourcein itspegRevision, as it changed between therangesin to the working copy path defined in operation'starget. If revision ranges are not provided, merges changes fromfirstSource/itspegRevisiontosecondSource/itspegRevisioninto the working copy path defined in operation'starget. The third case is ifreintegrateistrueperforms a reintegration merge ofsourceat itspegRevisioninto working copytarget.-
Merge between sources/revision ranges, no reintegration.
If
depthisSVNDepth.INFINITY, merges fully recursively. Else ifSVNDepth.IMMEDIATES, merges changes at most to files that are immediate children oftargetand to directory properties oftargetand its immediate subdirectory children. Else ifSVNDepth.FILES, merges at most to immediate file children oftargetand totargetitself. Else ifSVNDepth.EMPTY, applies changes only totarget(i.e., directory property changes only). IfdepthisSVNDepth.UNKNOWN, uses the depth oftarget. UsesignoreAncestryto control whether or not items being diffed will be checked for relatedness first. Unrelated items are typically transmitted to the editor as a deletion of one thing and the addition of another, but if this flag isfalse, unrelated items will be diffed as if they were related. Ifforceis not set and the merge involves deleting locally modified or unversioned items the operation will fail. Ifforceis set such items will be deleted. Merge optionsmergeOptionsis a collection ofSVNDiffOptions, they are used to pass arguments to the merge processes (internal or external). If the caller'sISVNEventHandleris notnull, then it will be called once for each merged target. IfrecordOnlyistrue, the merge isn't actually performed, but the mergeinfo for the revisions which would've been merged is recorded in the working copy (and must be subsequently committed back to the repository). IfdryRunistrue, the merge is carried out, and full notification feedback is provided, but the working copy is not modified.-
Merge between revision ranges.
Rangesis a collection ofSvnRevisionRangeranges. These ranges may describe additive and/or subtractive merge ranges, they may overlap fully or partially, and/or they may partially or fully negate each other. This range list is not required to be sorted. -
Merge between two sources.
FirstSourceandsecondSourcemust both represent the same node kind - that is, iffirstSourceis a directory,secondSourcemust also be, and iffirstSourceis a file,secondSourcemust also be.
-
Merge between revision ranges.
-
Reintegration merge.
This kind of merge should be used for back merging (for example, merging
branches back to trunk, in which case merge is carried out by comparing
the latest trunk tree with the latest branch tree; i.e. the resulting
difference is exactly the branch changes which will go back to trunk).
Destination
targetmust be a single-revision,SVNDepth.INFINITY, pristine, unswitched working copy - in other words, it must reflect a single revision tree, the "target". The mergeinfo onsourcemust reflect that all of the target has been merged into it. The depth of the merge is alwaysSVNDepth.INFINITY. Ifsource'spegRevisionisnullorinvalid, then it defaults toSVNRevision.HEAD.
SvnOperation.run()method throws org.tmatesoft.svn.core.SVNException in the following cases:-
exception with
SVNErrorCode.CLIENT_BAD_REVISION- If any revision in the list of provided ranges isinvalidexception withSVNErrorCode.CLIENT_BAD_REVISIONerror code - if eitherfirstSource'spegRevisionorfirstSource'spegRevisionisinvalid- Version:
- 1.7
- Author:
- TMate Software Ltd.
-
-
Field Summary
Fields Modifier and Type Field Description static booleanEMULATE_AUTOMATIC_MERGE
-
Constructor Summary
Constructors Modifier Constructor Description protectedSvnMerge(SvnOperationFactory factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRevisionRange(SvnRevisionRange range)Adds the revision range to collection of revision ranges for merging.SvnTargetgetFirstSource()Returns first source for merge between two sources.SVNDiffOptionsgetMergeOptions()Returns the operation's merge options controlling white-spaces and eol-styles.java.util.Collection<SvnRevisionRange>getRevisionRanges()Returns the collection ofSvnRevisionRangeranges.SvnTargetgetSecondSource()Returns second source for merge between two sources.SvnTargetgetSource()Returns source for merge between revisions and reintegrate merge.booleanisAllowMixedRevisions()Returns whether to allow merge target to have mixed revisions.booleanisChangesWorkingCopy()Gets whether the operation changes working copybooleanisDryRun()Returns whether the merge is carried out, and full notification feedback is provided, but the working copy is not modified.booleanisForce()Returns whether to fail if merge involves deleting locally modified or unversioned items.booleanisIgnoreAncestry()Returns whether or not items being diffed will be checked for relatedness first.booleanisIgnoreMergeInfo()booleanisRecordOnly()Returns whether the merge isn't actually performed, but the mergeinfo for the revisions which would've been merged is recorded in the working copy (and must be subsequently committed back to the repository).booleanisReintegrate()Returns whether it is reintegrate merge.voidsetAllowMixedRevisions(boolean allowMixedRevisions)Sets whether to allow merge target to have mixed revisions.voidsetDryRun(boolean dryRun)Sets whether the merge is carried out, and full notification feedback is provided, but the working copy is not modified.voidsetForce(boolean force)Sets whether to fail if merge involves deleting locally modified or unversioned items.voidsetIgnoreAncestry(boolean ignoreAncestry)Sets whether or not items being diffed will be checked for relatedness first.voidsetIgnoreMergeInfo(boolean ignoreMergeInfo)voidsetMergeOptions(SVNDiffOptions mergeOptions)Sets the operation's merge options controlling white-spaces and eol-styles.voidsetRecordOnly(boolean recordOnly)Sets whether the merge isn't actually performed, but the mergeinfo for the revisions which would've been merged is recorded in the working copy (and must be subsequently committed back to the repository).voidsetSource(SvnTarget source, boolean reintegrate)Sets source of the merge with reintegrate flag.voidsetSources(SvnTarget source1, SvnTarget source2)Sets first and seconds sources of the merge.-
Methods inherited from class org.tmatesoft.svn.core.wc2.SvnOperation
addTarget, cancel, ensureArgumentsAreValid, ensureEnoughTargets, ensureHomohenousTargets, getApplicableChangelists, getAuthenticationManager, getCanceller, getDepth, getEventHandler, getFirstTarget, getMaximumTargetsCount, getMinimumTargetsCount, getOperationalWorkingCopy, getOperationFactory, getOptions, getRepositoryPool, getRevision, getSqliteJournalMode, getTargets, hasFileTargets, hasLocalTargets, hasRemoteTargets, initDefaults, isCancelled, isSleepForTimestamp, isUseParentWcFormat, needsHomohenousTargets, run, setApplicalbeChangelists, setDepth, setRevision, setSingleTarget, setSleepForTimestamp, setSqliteJournalMode
-
-
-
-
Field Detail
-
EMULATE_AUTOMATIC_MERGE
public static final boolean EMULATE_AUTOMATIC_MERGE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SvnMerge
protected SvnMerge(SvnOperationFactory factory)
-
-
Method Detail
-
addRevisionRange
public void addRevisionRange(SvnRevisionRange range)
Adds the revision range to collection of revision ranges for merging.- Parameters:
range- revision range for merge- See Also:
getRevisionRanges()
-
getRevisionRanges
public java.util.Collection<SvnRevisionRange> getRevisionRanges()
Returns the collection ofSvnRevisionRangeranges. These ranges may describe additive and/or subtractive merge ranges, they may overlap fully or partially, and/or they may partially or fully negate each other. This range list is not required to be sorted.- Returns:
- revision ranges of the merge
-
setSource
public void setSource(SvnTarget source, boolean reintegrate)
Sets source of the merge with reintegrate flag. Thissourceis used in merge between revisions and reintegrate merge.- Parameters:
source- of mergereintegrate-trueif it is reintegrate merge, otherwisefalse- See Also:
isReintegrate()
-
setSources
public void setSources(SvnTarget source1, SvnTarget source2)
Sets first and seconds sources of the merge. Those sources are used in merge between two sources.- Parameters:
source1- first sourcesource2- second source
-
getSource
public SvnTarget getSource()
Returns source for merge between revisions and reintegrate merge.- Returns:
- merge source
-
getFirstSource
public SvnTarget getFirstSource()
Returns first source for merge between two sources.- Returns:
- first source of merge
-
getSecondSource
public SvnTarget getSecondSource()
Returns second source for merge between two sources.- Returns:
- first source of merge
-
isReintegrate
public boolean isReintegrate()
Returns whether it is reintegrate merge. This kind of merge should be used for back merging (for example, merging branches back to trunk, in which case merge is carried out by comparing the latest trunk tree with the latest branch tree; i.e. the resulting difference is exactly the branch changes which will go back to trunk).- Returns:
trueif it is reintegrate merge, otherwisefalse
-
isIgnoreMergeInfo
public boolean isIgnoreMergeInfo()
-
setIgnoreMergeInfo
public void setIgnoreMergeInfo(boolean ignoreMergeInfo)
-
isIgnoreAncestry
public boolean isIgnoreAncestry()
Returns whether or not items being diffed will be checked for relatedness first. Unrelated items are typically transmitted to the editor as a deletion of one thing and the addition of another, but if this flag isfalse, unrelated items will be diffed as if they were related.- Returns:
trueif ancestry should be ignored, otherwisefalse
-
setIgnoreAncestry
public void setIgnoreAncestry(boolean ignoreAncestry)
Sets whether or not items being diffed will be checked for relatedness first. Unrelated items are typically transmitted to the editor as a deletion of one thing and the addition of another, but if this flag isfalse, unrelated items will be diffed as if they were related.- Parameters:
ignoreAncestry-trueif ancestry should be ignored, otherwisefalse
-
isForce
public boolean isForce()
Returns whether to fail if merge involves deleting locally modified or unversioned items. Ifforceistruesuch items will be deleted, otherwise operation will fail.- Returns:
trueif operation should be forced to run, otherwisefalse
-
setForce
public void setForce(boolean force)
Sets whether to fail if merge involves deleting locally modified or unversioned items. Ifforceistruesuch items will be deleted, otherwise operation will fail.- Parameters:
force-trueif operation should be forced to run, otherwisefalse
-
isRecordOnly
public boolean isRecordOnly()
Returns whether the merge isn't actually performed, but the mergeinfo for the revisions which would've been merged is recorded in the working copy (and must be subsequently committed back to the repository).- Returns:
trueif operation should record only the result of merge - mergeinfo data, otherwisefalse
-
setRecordOnly
public void setRecordOnly(boolean recordOnly)
Sets whether the merge isn't actually performed, but the mergeinfo for the revisions which would've been merged is recorded in the working copy (and must be subsequently committed back to the repository).- Parameters:
recordOnly-trueif operation should record only the result of merge - mergeinfo data, otherwisefalse
-
isDryRun
public boolean isDryRun()
Returns whether the merge is carried out, and full notification feedback is provided, but the working copy is not modified.- Returns:
trueif the operation should only find out if a file can be merged successfully, otherwisefalse
-
setDryRun
public void setDryRun(boolean dryRun)
Sets whether the merge is carried out, and full notification feedback is provided, but the working copy is not modified.- Parameters:
dryRun-trueif the operation should only find out if a file can be merged successfully, otherwisefalse
-
isAllowMixedRevisions
public boolean isAllowMixedRevisions()
Returns whether to allow merge target to have mixed revisions. If set tofalseand target has mixed revisions,SVNExceptionis thrown with error codesSVNErrorCode.CLIENT_NOT_READY_TO_MERGEorSVNErrorCode.CLIENT_MERGE_UPDATE_REQUIRED.- Returns:
trueif operation allows merging to mixed-revision working copy, otherwisefalse- Since:
- 1.7, SVN 1.7
-
setAllowMixedRevisions
public void setAllowMixedRevisions(boolean allowMixedRevisions)
Sets whether to allow merge target to have mixed revisions. If set tofalseand target has mixed revisions,SVNExceptionis thrown with error codesSVNErrorCode.CLIENT_NOT_READY_TO_MERGEorSVNErrorCode.CLIENT_MERGE_UPDATE_REQUIRED.- Parameters:
allowMixedRevisions-trueif operation allows merging to mixed-revision working copy, otherwisefalse- Since:
- 1.7, SVN 1.7
-
getMergeOptions
public SVNDiffOptions getMergeOptions()
Returns the operation's merge options controlling white-spaces and eol-styles.- Returns:
- merge options of the operation
-
setMergeOptions
public void setMergeOptions(SVNDiffOptions mergeOptions)
Sets the operation's merge options controlling white-spaces and eol-styles.- Parameters:
mergeOptions- merge options of the operation
-
isChangesWorkingCopy
public boolean isChangesWorkingCopy()
Gets whether the operation changes working copy- Overrides:
isChangesWorkingCopyin classSvnOperation<java.lang.Void>- Returns:
trueif the operation changes the working copy, otherwisefalse
-
-