}
try {
SCMS: for (SCM scm : scmTriggerItem.getSCMs()) {
if (scm instanceof SubversionSCM) scmFound = true; else continue;
SCMTrigger trigger = scmTriggerItem.getSCMTrigger();
if (trigger!=null && !doesIgnorePostCommitHooks(trigger)) triggerFound = true; else continue;
SubversionSCM sscm = (SubversionSCM) scm;
List<SvnInfo> infos = new ArrayList<SvnInfo>();
boolean projectMatches = false;
for (ModuleLocation loc : sscm.getProjectLocations(p)) {
//LOGGER.fine("Checking uuid for module location + " + loc + " of job "+ p);
String url = loc.getURL();
String repositoryRootPath = null;
UUID remoteUUID = null;
for (Map.Entry<String, UUID> e : remoteUUIDCache.entrySet()) {
if (url.startsWith(e.getKey())) {
remoteUUID = e.getValue();
repositoryRootPath = SVNURL.parseURIDecoded(e.getKey()).getPath();
LOGGER.finer("Using cached uuid for module location " + url + " of job "+ p);
break;
}
}
if (remoteUUID == null) {
if (LOGGER.isLoggable(FINER)) {
LOGGER.finer("Could not find " + loc.getURL() + " in " + remoteUUIDCache.keySet().toString());
}
remoteUUID = loc.getUUID(p, scm);
SVNURL repositoryRoot = loc.getRepositoryRoot(p, scm);
repositoryRootPath = repositoryRoot.getPath();
remoteUUIDCache.put(repositoryRoot.toString(), remoteUUID);
}
if (remoteUUID.equals(uuid)) uuidFound = true; else continue;
String m = loc.getSVNURL().getPath();
String n = repositoryRootPath;
if(!m.startsWith(n)) continue; // repository root should be a subpath of the module path, but be defensive
String remaining = m.substring(n.length());
if(remaining.startsWith("/")) remaining=remaining.substring(1);
String remainingSlash = remaining + '/';
if ( rev != -1 ) {
infos.add(new SvnInfo(loc.getURL(), rev));
}
for (String path : affectedPath) {
if(path.equals(remaining) /*for files*/ || path.startsWith(remainingSlash) /*for dirs*/
|| remaining.length()==0/*when someone is checking out the whole repo (that is, m==n)*/) {
// this project is possibly changed. poll now.
// if any of the data we used was bogus, the trigger will not detect a change
projectMatches = true;
pathFound = true;
}
}
}
if (projectMatches) {
LOGGER.fine("Scheduling the immediate polling of "+p);
final RevisionParameterAction[] actions;
if (infos.isEmpty()) {
actions = new RevisionParameterAction[0];
} else {
actions = new RevisionParameterAction[] {
new RevisionParameterAction(infos)};
}
trigger.run(actions);
break SCMS;
}
}
} catch (SVNException e) {