diff cmdline/org/tmatesoft/hg/console/Main.java @ 232:b7347daa50e3

Allow to cat a file with changeset revision
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 02 Jun 2011 05:13:39 +0200
parents 1792b37650f2
children 1d389c0cb0a5
line wrap: on
line diff
--- a/cmdline/org/tmatesoft/hg/console/Main.java	Wed Jun 01 05:44:25 2011 +0200
+++ b/cmdline/org/tmatesoft/hg/console/Main.java	Thu Jun 02 05:13:39 2011 +0200
@@ -24,6 +24,7 @@
 import java.util.Map;
 
 import org.tmatesoft.hg.core.HgLogCommand.FileRevision;
+import org.tmatesoft.hg.core.HgCatCommand;
 import org.tmatesoft.hg.core.HgFileRevision;
 import org.tmatesoft.hg.core.HgManifestCommand;
 import org.tmatesoft.hg.core.Nodeid;
@@ -64,7 +65,8 @@
 
 	public static void main(String[] args) throws Exception {
 		Main m = new Main(args);
-		m.testMergeState();
+		m.testCatAtCsetRevision();
+//		m.testMergeState();
 //		m.testFileStatus();
 //		m.dumpBranches();
 //		m.inflaterLengthException();
@@ -77,6 +79,16 @@
 //		m.bunchOfTests();
 	}
 	
+	// TODO as test in TestCat
+	private void testCatAtCsetRevision() throws Exception {
+		HgCatCommand cmd = new HgCatCommand(hgRepo);
+		cmd.file(Path.create("src/org/tmatesoft/hg/internal/RevlogStream.java"));
+		cmd.changeset(Nodeid.fromAscii("08db726a0fb7914ac9d27ba26dc8bbf6385a0554"));
+		final ByteArrayChannel sink = new ByteArrayChannel();
+		cmd.execute(sink);
+		System.out.println(sink.toArray().length);
+	}
+	
 	private void testMergeState() throws Exception {
 		final HgMergeState mergeState = hgRepo.getMergeState();
 		mergeState.refresh();