Skip to content
Permalink
Browse files

[JENKINS-16711] Encode the URLs when are shown in the logger

  • Loading branch information...
recena committed Dec 30, 2015
1 parent dd63407 commit ec10c72dd0a4a05add0f63733d36450ff7f2e7a1
@@ -155,48 +155,56 @@ private boolean buildModule(PathContext context, SVNLogClient svnlc, DirAwareSVN
String url = context.url;
PrintStream logger = listener.getLogger();

Long prevRev = previousRevisions.get(url);
if (prevRev == null) {
logger.println("No revision recorded for " + url + " in the previous build");
return false;
}
try {
SVNURL repoURL = SVNURL.parseURIEncoded(url);

Long thisRev = thisRevisions.get(url);
if (thisRev == null) {
listener.error("No revision found for " + url + " in " + SubversionSCM.getRevisionFile(build) + ". Revision file contains: " + thisRevisions.keySet());
return false;
}
Long prevRev = previousRevisions.get(url);
if (prevRev == null) {
logger.println("No revision recorded for " + repoURL + " in the previous build");
return false;
}

if (thisRev.equals(prevRev)) {
logger.println("No changes for " + url + " since the previous build");
return false;
}
Long thisRev = thisRevisions.get(url);
if (thisRev == null) {
listener.error("No revision found for " + repoURL + " in " + SubversionSCM.getRevisionFile(build) + "" +
". Revision file contains: " + thisRevisions.keySet());
return false;
}

// handle case where previous workspace revision is newer than this revision
if (prevRev.compareTo(thisRev) > 0) {
long temp = thisRev;
thisRev = prevRev;
prevRev = temp;
}
if (thisRev.equals(prevRev)) {
logger.println("No changes for " + repoURL + " since the previous build");
return false;
}

logHandler.setContext(context);
try {
if(debug)
// handle case where previous workspace revision is newer than this revision
if (prevRev.compareTo(thisRev) > 0) {
long temp = thisRev;
thisRev = prevRev;
prevRev = temp;
}

logHandler.setContext(context);

if (debug) {
listener.getLogger().printf("Computing changelog of %1s from %2s to %3s%n",
SVNURL.parseURIEncoded(url), prevRev+1, thisRev);
SVNURL.parseURIEncoded(url), prevRev + 1, thisRev);
}

svnlc.doLog(SVNURL.parseURIEncoded(url),
null,
SVNRevision.UNDEFINED,
SVNRevision.create(prevRev+1),
SVNRevision.create(thisRev),
false, // Don't stop on copy.
true, // Report paths.
0, // Retrieve log entries for unlimited number of revisions.
debug ? new DebugSVNLogHandler(logHandler) : logHandler);
if(debug)
null,
SVNRevision.UNDEFINED,
SVNRevision.create(prevRev + 1),
SVNRevision.create(thisRev),
false, // Don't stop on copy.
true, // Report paths.
0, // Retrieve log entries for unlimited number of revisions.
debug ? new DebugSVNLogHandler(logHandler) : logHandler);

if (debug) {
listener.getLogger().println("done");
}
} catch (SVNException e) {
throw new IOException2("revision check failed on "+url,e);
throw new IOException2("revision check failed on " + url, e);
}
return true;
}
@@ -57,19 +57,19 @@ public void handleEvent(SVNEvent event, double progress) throws SVNException {

{// commit notifications
if (action == SVNEventAction.COMMIT_ADDED) {
out.println("Adding "+path);
out.println("Adding " + path);
return;
}
if (action == SVNEventAction.COMMIT_DELETED) {
out.println("Deleting "+path);
out.println("Deleting " + path);
return;
}
if (action == SVNEventAction.COMMIT_MODIFIED) {
out.println("Sending "+path);
out.println("Sending " + path);
return;
}
if (action == SVNEventAction.COMMIT_REPLACED) {
out.println("Replacing "+path);
out.println("Replacing " + path);
return;
}
if (action == SVNEventAction.COMMIT_DELTA_SENT) {
@@ -100,7 +100,7 @@ public void handleEvent(SVNEvent event, double progress) throws SVNException {
* from the repository
*/
pathChangeType = "U";
}else if (contentsStatus == SVNStatusType.CONFLICTED) {
} else if (contentsStatus == SVNStatusType.CONFLICTED) {
/*
* The file item is in a state of Conflict. That is, changes
* received from the repository during an update, overlap with
@@ -118,6 +118,7 @@ public void handleEvent(SVNEvent event, double progress) throws SVNException {
} else if (action == SVNEventAction.UPDATE_COMPLETED) {
// finished updating
out.println("At revision " + event.getRevision());
out.println();
return;
} else if (action == SVNEventAction.ADD){
out.println("A " + path);

0 comments on commit ec10c72

Please sign in to comment.
You can’t perform that action at this time.