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; }
/** * @param clientManager * @param file * @since 1.10 */ public static void blame( SVNClientManager clientManager, File file, ISVNAnnotateHandler handler ) throws SVNException { clientManager.getLogClient().doAnnotate( file, SVNRevision.UNDEFINED, SVNRevision.create( 1 ), SVNRevision.HEAD, true, false, handler, null ); }
/** * Returns the wc file. * @return detranslated wc file * @since 1.3 */ public File getPath() { return getMergeFiles().getLocalFile(); }
/** * Gets the repository revision just committed. */ public long revision() throws Exception { // .getLookClient().doGetYoungestRevision(repo) would show last committed revision but would not be sensitive to checked-out branch; which is clearer? return SVNClientManager.newInstance().getStatusClient().doStatus(wc, true).getRemoteRevision().getNumber(); // http://stackoverflow.com/a/2295674/12916 }
/** * Gets the SVN metadata for the given local workspace. * * @param workspace * The target to run "svn info". */ private SVNInfo parseSvnInfo(File workspace) throws SVNException { final SVNWCClient svnWc = manager.getWCClient(); return svnWc.doInfo(workspace,SVNRevision.WORKING); }
public static void changelog( SVNClientManager clientManager, SVNURL svnUrl, SVNRevision startRevision, SVNRevision endRevision, boolean stopOnCopy, boolean reportPaths, ISVNLogEntryHandler handler ) throws SVNException { SVNLogClient logClient = clientManager.getLogClient(); logClient.doLog( svnUrl, null, startRevision, startRevision, endRevision, stopOnCopy, reportPaths, MAX_LOG_ENTRIES, handler ); }
public static SVNCommitInfo mkdir( SVNClientManager clientManager, SVNURL[] urls, String commitMessage ) throws SVNException { SVNCommitInfo commitInfo = clientManager.getCommitClient().doMkDir( urls, commitMessage ); return commitInfo; }
protected SVNAdminBasicClient(final ISVNAuthenticationManager authManager, ISVNOptions options) { this(new DefaultSVNRepositoryPool(authManager == null ? SVNWCUtil .createDefaultAuthenticationManager() : authManager, options, 0, false), options); }
/** * Returns the working copy path which resulted in a conflict. * * @return working copy path * @since 1.3 */ public File getPath() { return getMergeFiles().getWCFile(); }
/** * Returns the encoding used for diff output. * * @return charset name */ public String getEncoding() { if (hasEncoding()) { return myEncoding; } return getOptions().getNativeCharset(); }
public void handleStatus(SVNStatus status) throws SVNException { if (deletedInRepository[0] && status.getEntry() != null) { status.setRemoteStatus(SVNStatusType.STATUS_DELETED, null, null, null); } handler.handleStatus(status); } };
public SVNConflictDescription toConflictDescription() { String wcPath = localAbspath != null ? localAbspath.getPath() : null; switch (kind) { case PROPERTY: return new SVNPropertyConflictDescription(new SVNMergeFileSet(null, null, baseFile, myFile, wcPath, theirFile, mergedFile, null, mimeType), nodeKind, propertyName, action, reason); case TEXT: return new SVNTextConflictDescription(new SVNMergeFileSet(null, null, baseFile, myFile, wcPath, theirFile, mergedFile, null, mimeType), nodeKind, action, reason); case TREE: return new SVNTreeConflictDescription(localAbspath, nodeKind, action, reason, operation, srcLeftVersion, srcRightVersion); } return null; }
protected void initClientDefaults(SVNBasicClient client) { client.setEventHandler(myEventHandler); client.setDebugLog(getDebugLog()); client.setIgnoreExternals(myIsIgnoreExternals); }
/** * @param shutdownAll whether to shutdown connection * that are considered active at the moment * @deprecated use {@link #dispose()} instead */ public void shutdownConnections(boolean shutdownAll) { if (getRepositoryPool() != null) { getRepositoryPool().dispose(); } }
/** * Gets the SVN metadata for the given local workspace. * * @param workspace * The target to run "svn info". */ private SVNInfo parseSvnInfo(File workspace) throws SVNException { final SVNWCClient svnWc = manager.getWCClient(); return svnWc.doInfo(workspace,SVNRevision.WORKING); }
/** * Returns the working copy path which resulted in a conflict. * * @return working copy path * @since 1.3 */ public File getPath() { return getMergeFiles().getWCFile(); }
/** * Returns the encoding used for diff output. * * @return charset name */ public String getEncoding() { if (hasEncoding()) { return myEncoding; } return getOptions().getNativeCharset(); }
/** * Returns the wc file. * @return detranslated wc file * @since 1.3 */ public File getPath() { return getMergeFiles().getLocalFile(); }
/** * Gets the SVN metadata for the given local workspace. * * @param workspace * The target to run "svn info". */ private SVNInfo parseSvnInfo(File workspace) throws SVNException { final SVNWCClient svnWc = manager.getWCClient(); return svnWc.doInfo(workspace,SVNRevision.WORKING); }
/** * Returns the encoding used for diff output. * * @return charset name */ public String getEncoding() { if (hasEncoding()) { return myEncoding; } return getOptions().getNativeCharset(); }