diff test/org/tmatesoft/hg/test/TestStatus.java @ 461:613c883e360e

Do not walk into nested repositories at all, ignore not only .hg but whole nested repo
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 20 Jun 2012 16:51:18 +0200
parents c95cd5994ba2
children 5c09a9f2e073
line wrap: on
line diff
--- a/test/org/tmatesoft/hg/test/TestStatus.java	Wed Jun 20 16:49:43 2012 +0200
+++ b/test/org/tmatesoft/hg/test/TestStatus.java	Wed Jun 20 16:51:18 2012 +0200
@@ -641,6 +641,23 @@
 		}
 		assertTrue(sc.getErrors().isEmpty());
 	}
+	
+	@Test
+	public void testNestedRepositoriesAreNotWalkedIn() throws Exception {
+		repo = Configuration.get().find("status-nested-repo");
+		File s2 = new File(repo.getWorkingDir(), "skip/s2/.hg/");
+		File s1 = new File(repo.getWorkingDir(), "s1/.hg/");
+		File s1b = new File(repo.getWorkingDir(), "s1/b");
+		assertTrue("[sanity]", s1.exists() && s1.isDirectory());
+		assertTrue("[sanity]", s1b.exists() && s1b.isFile());
+		assertTrue("[sanity]", s2.exists() && s2.isDirectory());
+		StatusCollector sc = new StatusCollector();
+		new HgStatusCommand(repo).all().execute(sc);
+		List<Path> ignored = sc.get(Ignored);
+		assertEquals(1, ignored.size());
+		assertEquals(Path.create("skip/a"), ignored.get(0));
+		assertTrue(sc.get(Path.create("s1/b")).isEmpty());
+	}
 
 	/*
 	 * With warm-up of previous tests, 10 runs, time in milliseconds