@Test public void testGetCommitId() { assertEquals(id, changeSet.getCommitId()); }
@Override public Boolean isRevExcluded( GitSCM scm, GitClient git, GitChangeSet commit, TaskListener listener, BuildData buildData) { Collection<String> paths = commit.getAffectedPaths(); if (paths.isEmpty()) { // nothing modified, so no need to compute any of this return true; } List<Pattern> included = getIncludedPatterns(); List<Pattern> excluded = getExcludedPatterns(); // Assemble the list of included paths List<String> includedPaths = new ArrayList<String>(paths.size()); if (!included.isEmpty()) { for (String path : paths) { for (Pattern pattern : included) { if (pattern.matcher(path).matches()) { includedPaths.add(path); break; } } } } else { includedPaths.addAll(paths); } // Assemble the list of excluded paths List<String> excludedPaths = new ArrayList<String>(); if (!excluded.isEmpty()) { for (String path : includedPaths) { for (Pattern pattern : excluded) { if (pattern.matcher(path).matches()) { excludedPaths.add(path); break; } } } } if (excluded.isEmpty() && !included.isEmpty() && includedPaths.isEmpty()) { listener .getLogger() .println( "Ignored commit " + commit.getCommitId() + ": No paths matched included region whitelist"); return true; } else if (includedPaths.size() == excludedPaths.size()) { // If every affected path is excluded, return true. listener .getLogger() .println( "Ignored commit " + commit.getCommitId() + ": Found only excluded paths: " + Util.join(excludedPaths, ", ")); return true; } return null; }