org.tmatesoft.svn.core.replicator
public class SVNRepositoryReplicator extends Object implements ISVNEventHandler
There's two general strategies for a replicator:
If the range of revisions being copied is [start, end]
,
then the target repository's last revision must be start - 1
.
For example, when copying from the very beginning of a source
repository, you pass start = 1
, what means that the target
repository's latest revision must be 0.
An incremental copying means copying from a source repository a revisions range starting at the revision equal to the target repository's latest revision + 1 (including) and up to the source repository's latest revision (also including). This allows to fill up missing revisions from the source repository in the target one, when you, say, once replicated the source repository and got some extra new revisions in it since then.
On condition that a user has got read permissions on the entire source repository and write permissions on the destination one, replicating guarantees that for each N th revision copied from the source repository the user'll have in the N th revision of the destination repository the same changes in both versioned and unversioned (revision properties) data except locks as in the source repository.
Since: 1.1.0
Version: 1.1.1
Method Summary | |
---|---|
void | checkCancelled()
Redirects a call to the registered handler's checkCancelled()
method.
|
protected void | fireReplicatedEvent(SVNCommitInfo commitInfo)
Fires a replicating iteration finished event to the registered
handler.
|
protected void | fireReplicatingEvent(SVNLogEntry revision)
Fires a replicating iteration started event to the registered
handler.
|
void | handleEvent(SVNEvent event, double progress)
Does nothing.
|
static SVNRepositoryReplicator | newInstance()
Creates a new repository replicator.
|
long | replicateRepository(SVNRepository src, SVNRepository dst, boolean incremental)
Replicates a repository either incrementally or totally.
|
long | replicateRepository(SVNRepository src, SVNRepository dst, long fromRevision, long toRevision)
Replicates a range of repository revisions.
|
void | setReplicationHandler(ISVNReplicationHandler handler)
Registers a replication handler to this replicator. |
checkCancelled()
method.
Throws: SVNCancelException
Parameters: commitInfo commit info about the copied revision (includes revision number, date, author)
Throws: SVNException
Parameters: revision log information about the revision to be copied
Throws: SVNException
Parameters: event progress
Throws: SVNException
Returns: a new replicator
If incremental
is true then
copies a range of revisions from the source repository starting at the
revision equal to dst.getLatestRevision() + 1
(including) and
expandig to src.getLatestRevision()
.
If incremental
is false then
the revision range to copy is [1, src.getLatestRevision()]
.
Both src
and dst
must be created for the root locations
of the repositories.
Parameters: src a source repository to copy from dst a destination repository to copy into incremental controls the way of copying
Returns: the number of copied revisions
Throws: SVNException
See Also: SVNRepositoryReplicator
Starts copying from fromRevision
(including) and expands to
toRevision
. If fromRevision <= 0
then it defaults
to revision 1. If toRevision
doesn't lie in (0, src.getLatestRevision()]
,
it defaults to src.getLatestRevision()
. The latest revision of the
destination repository must be equal to fromRevision - 1
, where fromRevision
is
already a valid revision.
The replicator uses a log operation to investigate the changed paths in every
revision to be copied. So, for each revision being replicated an appropriate
event with log information for that revision is fired
to the registered handler
(if any). Also during each copy
iteration the replicator tests the handler's checkCancelled()
method to check if the replication operation is cancelled. At the end of the copy operation
the replicator fires
yet one event with commit information about the replicated revision.
Both src
and dst
must be created for the root locations
of the repositories.
Parameters: src a source repository to copy from dst a destination repository to copy into fromRevision a start revision toRevision a final revision
Returns: the number of revisions copied from the source repository
Throws: SVNException
See Also: SVNRepositoryReplicator
Parameters: handler a replication handler