Permalink
Browse files

Fix for JENKINS-12361

Convert all paths to unix format before comparing prefixes
  • Loading branch information...
1 parent b259bfe commit f53ffd9826cb6d219d9013a2837d658ba4387da7 @kmbell kmbell committed Jan 10, 2012
@@ -325,8 +325,9 @@ private Change computeDegreeOfChanges(Set<String> changedFileNames, PrintStream
Set<String> affecting = new HashSet<String>();
for (String changedFile : changedFileNames) {
+ String unixChangedFile = changedFile.replace('\\', '/');
for (String dependency : _modules) {
- if (changedFile.startsWith(dependency)) {
+ if (unixChangedFile.startsWith(dependency)) {
affecting.add(changedFile);
break;
}
@@ -143,6 +143,25 @@ public void testPollingLimitedToModules2() throws Exception {
buildAndCheck(p, "dir1/f");
}
+ @Bug(12361)
+ public void testPollingLimitedToModules3() throws Exception {
+ PollingResult pr;
+ FreeStyleProject p = createFreeStyleProject();
+ p.setScm(new MercurialSCM(hgInstallation, repo.getPath(), null, "dir1/f",
+ null, null, false));
+ hg(repo, "init");
+ touchAndCommit(repo, "starter");
+ pollSCMChanges(p);
+ buildAndCheck(p, "starter");
+ touchAndCommit(repo, "dir1/g");
+ pr = pollSCMChanges(p);
+ assertEquals(PollingResult.Change.INSIGNIFICANT, pr.change);
+ touchAndCommit(repo, "dir1/f");
+ pr = pollSCMChanges(p);
+ assertEquals(PollingResult.Change.SIGNIFICANT, pr.change);
+ buildAndCheck(p, "dir1/f");
+ }
+
public void testParseStatus() throws Exception {
assertEquals(new HashSet<String>(Arrays.asList("whatever", "added", "mo-re", "whatever-c", "initial", "more")), MercurialSCM.parseStatus(
"M whatever\n"

0 comments on commit f53ffd9

Please sign in to comment.