/** * Gets the revision from a remote URL - i.e. the part after '@' if any * * @return the revision or null */ private static SVNRevision getRevisionFromRemoteUrl( String remoteUrlPossiblyWithRevision) { int idx = remoteUrlPossiblyWithRevision.lastIndexOf('@'); if (idx > 0) { String n = remoteUrlPossiblyWithRevision.substring(idx + 1); return SVNRevision.parse(n); } return null; }
public SVNRevision[] parseRevision(String revStr) { Matcher matcher = Pattern.compile("(\\{[^\\}]+\\}|[^:]+)((:)(.*))?").matcher(revStr); matcher.matches(); boolean colon = ":".equals(matcher.group(3)); SVNRevision r1 = SVNRevision.parse(matcher.group(1)); SVNRevision r2 = SVNRevision.parse(matcher.group(4)); return (colon && (r1 == SVNRevision.UNDEFINED || r2 == SVNRevision.UNDEFINED)) || r1 == SVNRevision.UNDEFINED ? null : new SVNRevision[]{r1, r2}; }
/** * Gets the revision from a remote URL - i.e. the part after '@' if any * * @return the revision or null */ private static SVNRevision getRevisionFromRemoteUrl( String remoteUrlPossiblyWithRevision) { int idx = remoteUrlPossiblyWithRevision.lastIndexOf('@'); if (idx > 0) { String n = remoteUrlPossiblyWithRevision.substring(idx + 1); return SVNRevision.parse(n); } return null; }
public SVNRevision[] parseRevision(String revStr) { Matcher matcher = Pattern.compile("(\\{[^\\}]+\\}|[^:]+)((:)(.*))?").matcher(revStr); matcher.matches(); boolean colon = ":".equals(matcher.group(3)); SVNRevision r1 = SVNRevision.parse(matcher.group(1)); SVNRevision r2 = SVNRevision.parse(matcher.group(4)); return (colon && (r1 == SVNRevision.UNDEFINED || r2 == SVNRevision.UNDEFINED)) || r1 == SVNRevision.UNDEFINED ? null : new SVNRevision[]{r1, r2}; }
/** * Gets the revision from a remote URL - i.e. the part after '@' if any * * @return the revision or null */ private static SVNRevision getRevisionFromRemoteUrl( String remoteUrlPossiblyWithRevision) { int idx = remoteUrlPossiblyWithRevision.lastIndexOf('@'); int slashIdx = remoteUrlPossiblyWithRevision.lastIndexOf('/'); if (idx > 0 && idx > slashIdx) { String n = remoteUrlPossiblyWithRevision.substring(idx + 1); return SVNRevision.parse(n); } return null; }
/** * Gets the revision from a remote URL - i.e. the part after '@' if any * * @return the revision or null * * TODO: This method should be in {@link SVNURL}. */ private static SVNRevision getRevisionFromRemoteUrl(String remoteUrlPossiblyWithRevision) { int idx = remoteUrlPossiblyWithRevision.lastIndexOf('@'); int slashIdx = remoteUrlPossiblyWithRevision.lastIndexOf('/'); if (idx > 0 && idx > slashIdx) { String n = remoteUrlPossiblyWithRevision.substring(idx + 1); return SVNRevision.parse(n); } return null; }
private static String getUrlWithoutRevision( String remoteUrlPossiblyWithRevision) { int idx = remoteUrlPossiblyWithRevision.lastIndexOf('@'); if (idx > 0) { String n = remoteUrlPossiblyWithRevision.substring(idx + 1); SVNRevision r = SVNRevision.parse(n); if ((r != null) && (r.isValid())) { return remoteUrlPossiblyWithRevision.substring(0, idx); } } return remoteUrlPossiblyWithRevision; }
public void changeFileProperty(String path, String name, String value) throws SVNException { if (name != null && !name.startsWith(SVNProperty.SVN_ENTRY_PREFIX) && !name.startsWith(SVNProperty.SVN_WC_PREFIX)) { myFileInfo.myIsPropertiesChanged = true; } if (SVNProperty.COMMITTED_REVISION.equals(name) && value != null) { myFileInfo.myRemoteRevision = SVNRevision.parse(value); } else if (SVNProperty.COMMITTED_DATE.equals(name) && value != null) { myFileInfo.myRemoteDate = SVNTimeUtil.parseDate(value); } else if (SVNProperty.LAST_AUTHOR.equals(name)) { myFileInfo.myRemoteAuthor = value; } }
public void changeDirProperty(String name, String value) throws SVNException { if (name != null && !name.startsWith(SVNProperty.SVN_ENTRY_PREFIX) && !name.startsWith(SVNProperty.SVN_WC_PREFIX)) { myDirectoryInfo.myIsPropertiesChanged = true; } if (SVNProperty.COMMITTED_REVISION.equals(name) && value != null) { myDirectoryInfo.myRemoteRevision = SVNRevision.parse(value); } else if (SVNProperty.COMMITTED_DATE.equals(name) && value != null) { myDirectoryInfo.myRemoteDate = SVNTimeUtil.parseDate(value); } else if (SVNProperty.LAST_AUTHOR.equals(name)) { myDirectoryInfo.myRemoteAuthor = value; } }
/** * Cuts off any optional '@revisionnr' and slashes from the end of the url string. */ public static String getUrlWithoutRevision(String remoteUrlPossiblyWithRevision) { int idx = remoteUrlPossiblyWithRevision.lastIndexOf('@'); int slashIdx = remoteUrlPossiblyWithRevision.lastIndexOf('/'); // Substitute optional '@revisionnr' String substititedString = remoteUrlPossiblyWithRevision; if (idx > 0 && idx > slashIdx) { String n = remoteUrlPossiblyWithRevision.substring(idx + 1); SVNRevision r = SVNRevision.parse(n); if ((r != null) && (r.isValid())) { substititedString = remoteUrlPossiblyWithRevision.substring(0, idx); } } // Substitute slashes at the end substititedString = substititedString.replaceAll(REGEX_END_SLASHES, ""); return substititedString; } }
private SVNRevision parseRevision(StringBuffer str) throws SVNException { int ind = str.indexOf(":"); if ( ind == -1) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.INCORRECT_PARAMS, "Found an unexpected \\0 in the file external ''{0}''", str); SVNErrorManager.error(err, SVNLogType.WC); } SVNRevision revision = null; String subStr = str.substring(0, ind); if (subStr.equals(SVNRevision.HEAD.getName())) { revision = SVNRevision.HEAD; } else { revision = SVNRevision.parse(subStr); } str = str.delete(0, ind + 1); return revision; }
public static SVNRevision parseRevision(StringBuffer str) throws SVNException { int ind = str.indexOf(":"); if ( ind == -1) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.INCORRECT_PARAMS, "Found an unexpected \\0 in the file external ''{0}''", str); SVNErrorManager.error(err, SVNLogType.WC); } SVNRevision revision = null; String subStr = str.substring(0, ind); if (subStr.equals(SVNRevision.HEAD.getName())) { revision = SVNRevision.HEAD; } else { revision = SVNRevision.parse(subStr); } str = str.delete(0, ind + 1); return revision; }
private SVNRevision parseRevision(StringBuffer str) throws SVNException { int ind = str.indexOf(":"); if ( ind == -1) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.INCORRECT_PARAMS, "Found an unexpected \\0 in the file external ''{0}''", str); SVNErrorManager.error(err, SVNLogType.WC); } SVNRevision revision = null; String subStr = str.substring(0, ind); if (subStr.equals(SVNRevision.HEAD.getName())) { revision = SVNRevision.HEAD; } else { revision = SVNRevision.parse(subStr); } str = str.delete(0, ind + 1); return revision; }
static String getUrlWithoutRevision( String remoteUrlPossiblyWithRevision) { String remoteUrlWithoutRevision = remoteUrlPossiblyWithRevision; if (Hudson.getInstance() != null) { for (NodeProperty n: Hudson.getInstance().getGlobalNodeProperties()) { EnvironmentVariablesNodeProperty gnp = (EnvironmentVariablesNodeProperty)n; for (Entry e : gnp.getEnvVars().entrySet()) { if (remoteUrlWithoutRevision.contains("${" + e.getKey().toString() + "}")) { remoteUrlWithoutRevision = remoteUrlWithoutRevision.replace("${" + e.getKey().toString() + "}", e.getValue().toString()); } } } } int idx = remoteUrlWithoutRevision.lastIndexOf('@'); if (idx > 0) { String n = remoteUrlWithoutRevision.substring(idx + 1); SVNRevision r = SVNRevision.parse(n); if ((r != null) && (r.isValid())) { return remoteUrlWithoutRevision.substring(0, idx); } } return remoteUrlWithoutRevision; }
revStr = SVNEncodingUtil.uriDecode(revStr); SVNRevision revision = SVNRevision.parse(revStr); if (revision != SVNRevision.UNDEFINED) { if (use) {
revStr = SVNEncodingUtil.uriDecode(revStr); SVNRevision revision = SVNRevision.parse(revStr); if (revision != SVNRevision.UNDEFINED) { if (use) {
revStr = SVNEncodingUtil.uriDecode(revStr); SVNRevision revision = SVNRevision.parse(revStr); if (revision != SVNRevision.UNDEFINED) { if (use) {
static List<Change> getChangesFromSubversion(@SuppressWarnings("rawtypes") AbstractBuild build, final Runner runner, SubversionSCM scm, final String remoteDebian, String latestRevision, String currentRevision, final String ourMessage) throws DebianizingException { final List<Change> result = new ArrayList<Change>(); ModuleLocation location = findOurLocation(build, scm, runner, remoteDebian); ISVNAuthenticationProvider authenticationProvider = ((SubversionSCM)build.getProject().getScm()).createAuthenticationProvider(build.getProject(), location); SvnClientManager manager = SubversionSCM.createClientManager(authenticationProvider); try { SVNURL svnurl = location.getSVNURL(); manager.getLogClient().doLog(svnurl, null, SVNRevision.UNDEFINED, SVNRevision.create(Long.parseLong(latestRevision) + 1), SVNRevision.parse(currentRevision), false, true, 0, new ISVNLogEntryHandler() { @Override public void handleLogEntry(SVNLogEntry logEntry) throws SVNException { if (!logEntry.getMessage().equals(ourMessage)) { result.add(new Change(logEntry.getAuthor(), logEntry.getMessage())); } } }); } catch (SVNException e) { e.printStackTrace(); throw new DebianizingException("SVNException: " + e.getMessage(), e); } finally { manager.dispose(); } return result; }
if ( revision != null ) svnRev = SVNRevision.parse( revision );