mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-03 12:05:52 +01:00
Fix SVN repo mirror update (#1745)
Initialize svn repository on mirror update if first initialization failed.
This commit is contained in:
@@ -85,7 +85,7 @@ public class SvnMirrorCommand extends AbstractSvnCommand implements MirrorComman
|
||||
SVNURL url = createUrlForLocalRepository();
|
||||
SVNAdminClient admin = createAdminClient(url, mirrorCommandRequest);
|
||||
|
||||
consumer.accept(admin);
|
||||
handleConsumer(mirrorCommandRequest, consumer, url, admin);
|
||||
afterUpdate = context.open().getLatestRevision();
|
||||
} catch (SVNException e) {
|
||||
LOG.info("Could not mirror svn repository", e);
|
||||
@@ -104,6 +104,19 @@ public class SvnMirrorCommand extends AbstractSvnCommand implements MirrorComman
|
||||
);
|
||||
}
|
||||
|
||||
private void handleConsumer(MirrorCommandRequest mirrorCommandRequest, AdminConsumer consumer, SVNURL url, SVNAdminClient admin) throws SVNException {
|
||||
try {
|
||||
consumer.accept(admin);
|
||||
} catch (SVNException e) {
|
||||
if (e.getMessage().equals("svn: E204899: Destination repository has not been initialized")) {
|
||||
SVNURL source = SVNURL.parseURIEncoded(mirrorCommandRequest.getSourceUrl());
|
||||
admin.doCompleteSynchronize(source, url);
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private SVNURL createUrlForLocalRepository() {
|
||||
try {
|
||||
return SVNURL.fromFile(context.getDirectory());
|
||||
|
||||
Reference in New Issue
Block a user