Search in sources :

Example 1 with SvnUpdate

use of org.tmatesoft.svn.core.wc2.SvnUpdate 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 SvnUpdate

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

the class SVNTest method main.

public static void main(String[] args) throws SVNException {
    final SvnTarget repository = SvnTarget.fromFile(new File("C:/Users/Jan/Repositories/GMM/src/main/webapp/WEB-INF/data/assets/SVnKit/Repo/trunk"));
    final SvnTarget workingCopy = SvnTarget.fromFile(new File("C:/Users/Jan/Repositories/GMM/src/main/webapp/WEB-INF/data/assets/SVnKit/WC"));
    final SvnUpdate update = svnOperationFactory.createUpdate();
    update.setSingleTarget(workingCopy);
    update.run();
    int i = 0;
    while (true) {
        i++;
    }
}
Also used : SvnTarget(org.tmatesoft.svn.core.wc2.SvnTarget) SvnUpdate(org.tmatesoft.svn.core.wc2.SvnUpdate) File(java.io.File)

Example 3 with SvnUpdate

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

the class SVNTest method updateWorkingCopy.

/**
 * Update(SVN) / Fetch(Git) local working copy with latest files from repo.
 */
public void updateWorkingCopy() throws SVNException {
    final SvnUpdate update = svnOperationFactory.createUpdate();
    update.setSingleTarget(workingCopy);
    final long[] revisions = update.run();
}
Also used : SvnUpdate(org.tmatesoft.svn.core.wc2.SvnUpdate)

Aggregations

SvnUpdate (org.tmatesoft.svn.core.wc2.SvnUpdate)3 File (java.io.File)1 SVNException (org.tmatesoft.svn.core.SVNException)1 SVNStatus (org.tmatesoft.svn.core.wc.SVNStatus)1 SvnTarget (org.tmatesoft.svn.core.wc2.SvnTarget)1