Search in sources :

Example 1 with SvnStatus

use of org.tmatesoft.svn.core.wc2.SvnStatus in project spring-cloud-config by spring-cloud.

the class SvnKitEnvironmentRepository method update.

private String update(SvnOperationFactory svnOperationFactory, String label) throws SVNException {
    logger.debug("Repo already checked out - updating instead.");
    try {
        final SvnUpdate update = svnOperationFactory.createUpdate();
        update.setSingleTarget(SvnTarget.fromFile(getWorkingDirectory()));
        long[] ids = update.run();
        StringBuilder version = new StringBuilder();
        for (long id : ids) {
            if (version.length() > 0) {
                version.append(",");
            }
            version.append(id);
        }
        return version.toString();
    } catch (Exception e) {
        String message = "Could not update remote for " + label + " (current local=" + getWorkingDirectory().getPath() + "), remote: " + this.getUri() + ")";
        if (logger.isDebugEnabled()) {
            logger.debug(message, e);
        } else if (logger.isWarnEnabled()) {
            logger.warn(message);
        }
    }
    final SVNStatus status = SVNClientManager.newInstance().getStatusClient().doStatus(getWorkingDirectory(), false);
    return status != null ? status.getRevision().toString() : null;
}
Also used : SVNStatus(org.tmatesoft.svn.core.wc.SVNStatus) SvnUpdate(org.tmatesoft.svn.core.wc2.SvnUpdate) SVNException(org.tmatesoft.svn.core.SVNException)

Example 2 with SvnStatus

use of org.tmatesoft.svn.core.wc2.SvnStatus in project GMM by Katharsas.

the class SvnPlugin method verifyExistingWorkingCopy.

private void verifyExistingWorkingCopy() {
    final SvnGetStatus ops = svnOperationFactory.createGetStatus();
    ops.setSingleTarget(workingCopy);
    ops.setReportAll(logger.isDebugEnabled());
    final Collection<SvnStatus> statuses = tryRun(ops, new ArrayList<>(SvnStatus.class));
    for (final SvnStatus entry : statuses) {
        final SVNStatusType type = entry.getNodeStatus();
        final String filePath = entry.getPath().getPath();
        if (type != SVNStatusType.STATUS_NORMAL) {
            logger.error("Existing working copy is in an invalid state (maybe modified)! " + "Pls fix manually or delete working copy at '" + workingCopy + "'.");
            throw new ConfigurationException("Found entry with invalid status in working copy! " + "Relative path: '" + filePath + "'. Status: '" + type + "'.");
        }
    }
}
Also used : SvnGetStatus(org.tmatesoft.svn.core.wc2.SvnGetStatus) ConfigurationException(gmm.ConfigurationException) SVNStatusType(org.tmatesoft.svn.core.wc.SVNStatusType) SvnStatus(org.tmatesoft.svn.core.wc2.SvnStatus)

Aggregations

ConfigurationException (gmm.ConfigurationException)1 SVNException (org.tmatesoft.svn.core.SVNException)1 SVNStatus (org.tmatesoft.svn.core.wc.SVNStatus)1 SVNStatusType (org.tmatesoft.svn.core.wc.SVNStatusType)1 SvnGetStatus (org.tmatesoft.svn.core.wc2.SvnGetStatus)1 SvnStatus (org.tmatesoft.svn.core.wc2.SvnStatus)1 SvnUpdate (org.tmatesoft.svn.core.wc2.SvnUpdate)1