diff test/org/tmatesoft/hg/test/TestBlame.java @ 556:e55f17a7a195

AnnotateFacility renamed to HgBlameFacility and exposed, API shapes out and got some javadoc
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 22 Feb 2013 20:21:24 +0100
parents e623aa2ca526
children b9e5ac26dd83
line wrap: on
line diff
--- a/test/org/tmatesoft/hg/test/TestBlame.java	Fri Feb 22 19:03:25 2013 +0100
+++ b/test/org/tmatesoft/hg/test/TestBlame.java	Fri Feb 22 20:21:24 2013 +0100
@@ -32,20 +32,20 @@
 import org.junit.Rule;
 import org.junit.Test;
 import org.tmatesoft.hg.core.HgIterateDirection;
-import org.tmatesoft.hg.internal.AnnotateFacility;
-import org.tmatesoft.hg.internal.AnnotateFacility.AddBlock;
-import org.tmatesoft.hg.internal.AnnotateFacility.Block;
-import org.tmatesoft.hg.internal.AnnotateFacility.BlockData;
-import org.tmatesoft.hg.internal.AnnotateFacility.ChangeBlock;
-import org.tmatesoft.hg.internal.AnnotateFacility.DeleteBlock;
-import org.tmatesoft.hg.internal.AnnotateFacility.EqualBlock;
 import org.tmatesoft.hg.internal.FileAnnotation;
 import org.tmatesoft.hg.internal.FileAnnotation.LineDescriptor;
 import org.tmatesoft.hg.internal.FileAnnotation.LineInspector;
 import org.tmatesoft.hg.internal.IntVector;
+import org.tmatesoft.hg.repo.HgBlameFacility;
 import org.tmatesoft.hg.repo.HgDataFile;
 import org.tmatesoft.hg.repo.HgLookup;
 import org.tmatesoft.hg.repo.HgRepository;
+import org.tmatesoft.hg.repo.HgBlameFacility.AddBlock;
+import org.tmatesoft.hg.repo.HgBlameFacility.Block;
+import org.tmatesoft.hg.repo.HgBlameFacility.BlockData;
+import org.tmatesoft.hg.repo.HgBlameFacility.ChangeBlock;
+import org.tmatesoft.hg.repo.HgBlameFacility.DeleteBlock;
+import org.tmatesoft.hg.repo.HgBlameFacility.EqualBlock;
 
 /**
  * 
@@ -65,7 +65,7 @@
 		final int checkChangeset = 539;
 		HgDataFile df = repo.getFileNode(fname);
 		ByteArrayOutputStream bos = new ByteArrayOutputStream();
-		new AnnotateFacility().annotateSingleRevision(df, checkChangeset, new DiffOutInspector(new PrintStream(bos)));
+		new HgBlameFacility().annotateSingleRevision(df, checkChangeset, new DiffOutInspector(new PrintStream(bos)));
 		LineGrepOutputParser gp = new LineGrepOutputParser("^@@.+");
 		ExecHelper eh = new ExecHelper(gp, null);
 		eh.run("hg", "diff", "-c", String.valueOf(checkChangeset), "-U", "0", fname);
@@ -106,7 +106,7 @@
 	public void testComplexHistoryAnnotate() throws Exception {
 		HgRepository repo = Configuration.get().find("test-annotate");
 		HgDataFile df = repo.getFileNode("file1");
-		AnnotateFacility af = new AnnotateFacility();
+		HgBlameFacility af = new HgBlameFacility();
 		ByteArrayOutputStream bos = new ByteArrayOutputStream();
 		DiffOutInspector dump = new DiffOutInspector(new PrintStream(bos));
 		af.annotate(df, TIP, dump, HgIterateDirection.OldToNew);
@@ -114,7 +114,6 @@
 		
 		LineGrepOutputParser gp = new LineGrepOutputParser("^@@.+");
 		ExecHelper eh = new ExecHelper(gp, repo.getWorkingDir());
-		System.out.println(Arrays.toString(dump.getReportedTargetRevisions()));
 		for (int cs : dump.getReportedTargetRevisions()) {
 			gp.reset();
 			eh.run("hg", "diff", "-c", String.valueOf(cs), "-U", "0", df.getPath().toString());
@@ -158,7 +157,7 @@
 		final String fname = "src/org/tmatesoft/hg/internal/PatchGenerator.java";
 		final int checkChangeset = 539;
 		HgDataFile df = repo.getFileNode(fname);
-		AnnotateFacility af = new AnnotateFacility();
+		HgBlameFacility af = new HgBlameFacility();
 		DiffOutInspector dump = new DiffOutInspector(System.out);
 		System.out.println("541 -> 543");
 		af.annotateSingleRevision(df, 543, dump);
@@ -183,7 +182,7 @@
 		final String fname = "src/org/tmatesoft/hg/repo/HgManifest.java";
 		final int checkChangeset = 415;
 		HgDataFile df = repo.getFileNode(fname);
-		AnnotateFacility af = new AnnotateFacility();
+		HgBlameFacility af = new HgBlameFacility();
 		DiffOutInspector dump = new DiffOutInspector(System.out);
 //		System.out.println("413 -> 415");
 //		af.diff(df, 413, 415, dump);
@@ -199,7 +198,7 @@
 	private void ccc() throws Exception {
 		HgRepository repo = new HgLookup().detect("/home/artem/hg/junit-test-repos/test-annotate/");
 		HgDataFile df = repo.getFileNode("file1");
-		AnnotateFacility af = new AnnotateFacility();
+		HgBlameFacility af = new HgBlameFacility();
 		DiffOutInspector dump = new DiffOutInspector(System.out);
 		dump.needRevisions(true);
 		af.annotate(df, TIP, dump, HgIterateDirection.OldToNew);
@@ -223,7 +222,7 @@
 		new TestBlame().ccc();
 	}
 
-	private static class DiffOutInspector implements AnnotateFacility.BlockInspector {
+	private static class DiffOutInspector implements HgBlameFacility.BlockInspector {
 		private final PrintStream out;
 		private boolean dumpRevs;
 		private IntVector reportedRevisionPairs = new IntVector();
@@ -326,7 +325,7 @@
 		}
 	}
 
-	private static class LineDumpInspector implements AnnotateFacility.BlockInspector {
+	private static class LineDumpInspector implements HgBlameFacility.BlockInspector {
 		
 		private final boolean lineByLine;