Package org.tmatesoft.svn.core.wc2
Class SvnLog
- java.lang.Object
-
- org.tmatesoft.svn.core.wc2.SvnOperation<T>
-
- org.tmatesoft.svn.core.wc2.SvnReceivingOperation<SVNLogEntry>
-
- org.tmatesoft.svn.core.wc2.SvnLog
-
- All Implemented Interfaces:
ISvnObjectReceiver<SVNLogEntry>,ISvnOperationOptionsProvider
public class SvnLog extends SvnReceivingOperation<SVNLogEntry>
Represents log operation. Gets commit log messages with other revision specific information fortarget' paths(targetPaths) from a repository and returns them as list ofSVNLogEntryitems. Useful for observing the history of affected paths, author, date and log comments information per revision.Targetcan represent one repository URL with list of relative paths -targetPathsor many targets representing working copy paths can be provided, andtargetPathsshould not be set. Operation finds root URL of the working copy paths, and calculates relativetargetPathsfor them. Operation createsSVNLogEntryitem on each log message fromstartRevisiontoendRevisionin turn, inclusive (but never creates item on a given log message more than once). Log entries are created only on messages whose revisions involved a change to some path intargetPaths.Targets'pegRevisionsindicates in which revisiontargetPaths' paths are valid. Iftarget'spegRevisionisinvalid, it defaults toSVNRevision.WORKINGiftargetis working copy path, orSVNRevision.HEADiftargetis URL. Iflimitis non-zero, only creates firstlimitlog entries. IfdiscoverChangedPathsis set, then the changed pathsMapargument will be passed to a constructor ofSVNLogEntryon each invocation ofhandler. IfstopOnCopyis set, copy history (if any exists) will not be traversed while harvesting revision logs for eachtargetPath. IfuseMergedHistoryis set, log information for revisions which have been merged totargetPathswill also be returned. Refer toSVNLogEntry.hasChildren()for additional information on how to handle mergeinfo information during a log operation. IfrevisionPropertiesisnull, retrieves all revision properties; else, retrieves only the revision properties named in the array (i.e. retrieves none if the array is empty). For everySvnRevisionRangeinrevisionRanges: IfstartRevisionisvalidbutendRevisionis not, thenendRevisiondefaults tostartRevision. If bothstartRevisionandendRevisionare invalid, thenendRevisiondefaults to revision0, andstartRevisiondefaults either totarget'spegRevisionin case the latter one is valid, or toSVNRevision.BASE, if it is not. Important: to avoid an exception with theSVNErrorCode.FS_NO_SUCH_REVISIONerror code when invoked against an empty repository (i.e. one not containing a revision 1), callers should specify the rangeSVNRevision.HEAD:0. If the caller has provided a non-nullISVNEventHandler, it will be called with theSVNEventAction.SKIPevent action on any unversioned paths. Note: this routine requires repository access.SvnOperation.run()method throwsSVNExceptionin if one of the following is true:- a path is not under version control
- can not obtain a URL of a working copy path
pathscontain entries that belong to different repositories
- See Also:
SVNLogEntry
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSvnLog(SvnOperationFactory factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRange(SvnRevisionRange range)Adds the revision range to the operation's revision ranges.protected voidensureArgumentsAreValid()longgetLimit()Returns a maximum number of log entries to be processedprotected intgetMaximumTargetsCount()java.lang.String[]getRevisionProperties()Returns what properties should be retrieved.java.util.Collection<SvnRevisionRange>getRevisionRanges()Returns all revision ranges for those log should be reported.java.lang.String[]getTargetPaths()Returns all relative paths what should be reported for eachtarget.booleanisChangesWorkingCopy()Gets whether the operation changes working copybooleanisDiscoverChangedPaths()Returns whether to report of all changed paths for every revision being processed Iftruethen the changed pathsMapargument will be passed to a constructor ofSVNLogEntry.booleanisStopOnCopy()Returns whether to copy history (if any exists) should be traversed while harvesting revision logs for eachtargetPath.booleanisUseMergeHistory()Returns whether the log information for revisions which have been merged totargetPathswill also be returned.voidsetDiscoverChangedPaths(boolean discoverChangedPaths)Sets whether to report of all changed paths for every revision being processed Iftruethen the changed pathsMapargument will be passed to a constructor ofSVNLogEntry.voidsetLimit(long limit)Sets a maximum number of log entries to be processedvoidsetRevisionProperties(java.lang.String[] revisionProperties)Sets what properties should be retrieved.voidsetRevisionRanges(java.util.Collection<SvnRevisionRange> revisionRanges)Sets all revision ranges for those log should be reported.voidsetStopOnCopy(boolean stopOnCopy)Sets whether to copy history (if any exists) should be traversed while harvesting revision logs for eachtargetPath.voidsetTargetPaths(java.lang.String[] targetPaths)Sets all relative paths what should be reported for eachtarget.voidsetUseMergeHistory(boolean useMergeHistory)Sets whether the log information for revisions which have been merged totargetPathswill also be returned.-
Methods inherited from class org.tmatesoft.svn.core.wc2.SvnReceivingOperation
first, getReceiver, initDefaults, last, receive, run, setReceiver
-
Methods inherited from class org.tmatesoft.svn.core.wc2.SvnOperation
addTarget, cancel, ensureEnoughTargets, ensureHomohenousTargets, getApplicableChangelists, getAuthenticationManager, getCanceller, getDepth, getEventHandler, getFirstTarget, getMinimumTargetsCount, getOperationalWorkingCopy, getOperationFactory, getOptions, getRepositoryPool, getRevision, getSqliteJournalMode, getTargets, hasFileTargets, hasLocalTargets, hasRemoteTargets, isCancelled, isSleepForTimestamp, isUseParentWcFormat, needsHomohenousTargets, run, setApplicalbeChangelists, setDepth, setRevision, setSingleTarget, setSleepForTimestamp, setSqliteJournalMode
-
-
-
-
Constructor Detail
-
SvnLog
protected SvnLog(SvnOperationFactory factory)
-
-
Method Detail
-
getLimit
public long getLimit()
Returns a maximum number of log entries to be processed- Returns:
- maximum number of entries
-
setLimit
public void setLimit(long limit)
Sets a maximum number of log entries to be processed- Parameters:
limit- maximum number of entries
-
isUseMergeHistory
public boolean isUseMergeHistory()
Returns whether the log information for revisions which have been merged totargetPathswill also be returned.- Returns:
trueif merged revisions should be also reported, otherwisefalse
-
setUseMergeHistory
public void setUseMergeHistory(boolean useMergeHistory)
Sets whether the log information for revisions which have been merged totargetPathswill also be returned.- Parameters:
useMergeHistory-trueif merged revisions should be also reported, otherwisefalse
-
isDiscoverChangedPaths
public boolean isDiscoverChangedPaths()
Returns whether to report of all changed paths for every revision being processed Iftruethen the changed pathsMapargument will be passed to a constructor ofSVNLogEntry.- Returns:
trueif all changed paths for every revision being processed should be reported, otherwisefalse
-
setDiscoverChangedPaths
public void setDiscoverChangedPaths(boolean discoverChangedPaths)
Sets whether to report of all changed paths for every revision being processed Iftruethen the changed pathsMapargument will be passed to a constructor ofSVNLogEntry.- Parameters:
discoverChangedPaths-trueif all changed paths for every revision being processed should be reported, otherwisefalse
-
isStopOnCopy
public boolean isStopOnCopy()
Returns whether to copy history (if any exists) should be traversed while harvesting revision logs for eachtargetPath.- Returns:
trueif not to cross copies while traversing history, otherwise copies history will be also included into processing
-
setStopOnCopy
public void setStopOnCopy(boolean stopOnCopy)
Sets whether to copy history (if any exists) should be traversed while harvesting revision logs for eachtargetPath.- Parameters:
stopOnCopy-trueif not to cross copies while traversing history, otherwise copies history will be also included into processing
-
getRevisionRanges
public java.util.Collection<SvnRevisionRange> getRevisionRanges()
Returns all revision ranges for those log should be reported.- Returns:
- collection of
SVNRevisionRangeobjects
-
setRevisionRanges
public void setRevisionRanges(java.util.Collection<SvnRevisionRange> revisionRanges)
Sets all revision ranges for those log should be reported.- Parameters:
revisionRanges- collection ofSVNRevisionRangeobjects
-
getTargetPaths
public java.lang.String[] getTargetPaths()
Returns all relative paths what should be reported for eachtarget.- Returns:
- relative paths of the
target
-
setTargetPaths
public void setTargetPaths(java.lang.String[] targetPaths)
Sets all relative paths what should be reported for eachtarget.- Parameters:
targetPaths- relative paths of thetarget
-
getRevisionProperties
public java.lang.String[] getRevisionProperties()
Returns what properties should be retrieved. IfrevisionPropertiesisnull, retrieves all revision properties; else retrieves only the revision properties named in the array (i.e. retrieves none if the array is empty).- Returns:
- array of names of the properties
-
setRevisionProperties
public void setRevisionProperties(java.lang.String[] revisionProperties)
Sets what properties should be retrieved. IfrevisionPropertiesisnull, retrieves all revision properties; else retrieves only the revision properties named in the array (i.e. retrieves none if the array is empty).- Parameters:
revisionProperties- array of names of the properties
-
ensureArgumentsAreValid
protected void ensureArgumentsAreValid() throws SVNException- Overrides:
ensureArgumentsAreValidin classSvnOperation<SVNLogEntry>- Throws:
SVNException
-
addRange
public void addRange(SvnRevisionRange range)
Adds the revision range to the operation's revision ranges.- Parameters:
range- revision range
-
getMaximumTargetsCount
protected int getMaximumTargetsCount()
- Overrides:
getMaximumTargetsCountin classSvnOperation<SVNLogEntry>
-
isChangesWorkingCopy
public boolean isChangesWorkingCopy()
Gets whether the operation changes working copy- Overrides:
isChangesWorkingCopyin classSvnOperation<SVNLogEntry>- Returns:
trueif the operation changes the working copy, otherwisefalse
-
-