Skip to content

Commit

Permalink
[JENKINS-13027] add warning when stripping invalid client spec lines
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Petti committed Mar 15, 2012
1 parent 1d951fc commit a5bb228
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/main/java/hudson/plugins/perforce/PerforceSCM.java
Expand Up @@ -1381,7 +1381,7 @@ else if (localPath.trim().equals(""))
if (useClientSpec) {
projectPath = getEffectiveProjectPathFromFile(build, project, log, depot);
}
List<String> mappingPairs = parseProjectPath(projectPath, p4Client);
List<String> mappingPairs = parseProjectPath(projectPath, p4Client, log);
if (!equalsProjectPath(mappingPairs, p4workspace.getViews())) {
log.println("Changing P4 Client View from:\n" + p4workspace.getViewsAsString());
log.println("Changing P4 Client View to: ");
Expand Down Expand Up @@ -1932,6 +1932,11 @@ public String getAppName() {
* mappings with an implied right part. It can also deal with +// or -// mapping forms.
*/
public static List<String> parseProjectPath(String projectPath, String p4Client) {
PrintStream log = (new LogTaskListener(LOGGER, Level.WARNING)).getLogger();
return parseProjectPath(projectPath, p4Client, log);
}

public static List<String> parseProjectPath(String projectPath, String p4Client, PrintStream log) {
List<String> parsed = new ArrayList<String>();
for (String line : projectPath.split("\n")) {
Matcher depotOnly = DEPOT_ONLY.matcher(line);
Expand Down Expand Up @@ -1963,9 +1968,12 @@ public static List<String> parseProjectPath(String projectPath, String p4Client)
// add the found depot path and the clientname-tweaked client path
parsed.add(depotAndQuotedWorkspace.group(1));
parsed.add("\"//" + p4Client + depotAndQuotedWorkspace.group(2) + "\"");
} else {
// Assume anything else is a comment and ignore it
// Throw a warning anyways.
log.println("Warning: Client Spec line invalid, ignoring. ("+line+")");
}
}
// Assume anything else is a comment and ignore it
}
}
}
Expand Down

0 comments on commit a5bb228

Please sign in to comment.