Source:
private HttpResponse handleNotifyCommit(URI url) throws ServletException, IOException { final List<AbstractProject<?,?>> projects = Lists.newArrayList(); boolean scmFound = false, triggerFound = false, urlFound = false; for (AbstractProject<?,?> project : Hudson.getInstance().getAllItems(AbstractProject.class)) { SCM scm = project.getScm(); if (scm instanceof MercurialSCM) scmFound = true; else continue; MercurialSCM hg = (MercurialSCM) scm; String repository = hg.getSource(); if (repository == null) { LOGGER.log(Level.WARNING, "project " + project.getDisplayName() + " is using source control but does not identify a repository"); } LOGGER.log(Level.INFO, "url == " + url + " repository == " + repository); if (looselyMatches(url, repository)) urlFound = true; else continue; SCMTrigger trigger = project.getTrigger(SCMTrigger.class); if (trigger!=null) triggerFound = true; else continue; LOGGER.log(Level.INFO, "Triggering the polling of {0}", project.getFullDisplayName()); trigger.run(); projects.add(project); } final String msg; if (!scmFound) msg = "No mercurial jobs found"; else if (!urlFound) msg = "No mercurial jobs using repository: " + url; else if (!triggerFound) msg = "Jobs found but they aren't configured for polling"; else msg = null; return new HttpResponse() { public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node) throws IOException, ServletException { rsp.setStatus(SC_OK); rsp.setContentType("text/plain"); for (AbstractProject<?, ?> p : projects) { rsp.addHeader("Triggered", p.getAbsoluteUrl()); } PrintWriter w = rsp.getWriter(); for (AbstractProject<?, ?> p : projects) { w.println("Scheduled polling of "+p.getFullDisplayName()); } if (msg!=null) w.println(msg); } }; }

Target:
private HttpResponse handleNotifyCommit(URI url) throws ServletException, IOException { final List<AbstractProject<?,?>> projects = Lists.newArrayList(); boolean scmFound = false, triggerFound = false, urlFound = false; for (AbstractProject<?,?> project : Hudson.getInstance().getAllItems(AbstractProject.class)) { SCM scm = project.getScm(); if (scm instanceof MercurialSCM) scmFound = true; else continue; MercurialSCM hg = (MercurialSCM) scm; String repository = hg.getSource(); if (repository == null) { LOGGER.log(Level.FINE, "project " + project.getDisplayName() + " is using source control but does not identify a repository"); continue; } LOGGER.log(Level.INFO, "url == " + url + " repository == " + repository); if (looselyMatches(url, repository)) urlFound = true; else continue; SCMTrigger trigger = project.getTrigger(SCMTrigger.class); if (trigger!=null) triggerFound = true; else continue; LOGGER.log(Level.INFO, "Triggering the polling of {0}", project.getFullDisplayName()); trigger.run(); projects.add(project); } final String msg; if (!scmFound) msg = "No mercurial jobs found"; else if (!urlFound) msg = "No mercurial jobs using repository: " + url; else if (!triggerFound) msg = "Jobs found but they aren't configured for polling"; else msg = null; return new HttpResponse() { public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node) throws IOException, ServletException { rsp.setStatus(SC_OK); rsp.setContentType("text/plain"); for (AbstractProject<?, ?> p : projects) { rsp.addHeader("Triggered", p.getAbsoluteUrl()); } PrintWriter w = rsp.getWriter(); for (AbstractProject<?, ?> p : projects) { w.println("Scheduled polling of "+p.getFullDisplayName()); } if (msg!=null) w.println(msg); } }; }