comparison 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
comparison
equal deleted inserted replaced
231:1792b37650f2 232:b7347daa50e3
22 import java.util.Collections; 22 import java.util.Collections;
23 import java.util.List; 23 import java.util.List;
24 import java.util.Map; 24 import java.util.Map;
25 25
26 import org.tmatesoft.hg.core.HgLogCommand.FileRevision; 26 import org.tmatesoft.hg.core.HgLogCommand.FileRevision;
27 import org.tmatesoft.hg.core.HgCatCommand;
27 import org.tmatesoft.hg.core.HgFileRevision; 28 import org.tmatesoft.hg.core.HgFileRevision;
28 import org.tmatesoft.hg.core.HgManifestCommand; 29 import org.tmatesoft.hg.core.HgManifestCommand;
29 import org.tmatesoft.hg.core.Nodeid; 30 import org.tmatesoft.hg.core.Nodeid;
30 import org.tmatesoft.hg.internal.ByteArrayChannel; 31 import org.tmatesoft.hg.internal.ByteArrayChannel;
31 import org.tmatesoft.hg.internal.DigestHelper; 32 import org.tmatesoft.hg.internal.DigestHelper;
62 System.out.println("REPO:" + hgRepo.getLocation()); 63 System.out.println("REPO:" + hgRepo.getLocation());
63 } 64 }
64 65
65 public static void main(String[] args) throws Exception { 66 public static void main(String[] args) throws Exception {
66 Main m = new Main(args); 67 Main m = new Main(args);
67 m.testMergeState(); 68 m.testCatAtCsetRevision();
69 // m.testMergeState();
68 // m.testFileStatus(); 70 // m.testFileStatus();
69 // m.dumpBranches(); 71 // m.dumpBranches();
70 // m.inflaterLengthException(); 72 // m.inflaterLengthException();
71 // m.dumpIgnored(); 73 // m.dumpIgnored();
72 // m.dumpDirstate(); 74 // m.dumpDirstate();
73 // m.testStatusInternals(); 75 // m.testStatusInternals();
74 // m.catCompleteHistory(); 76 // m.catCompleteHistory();
75 // m.dumpCompleteManifestLow(); 77 // m.dumpCompleteManifestLow();
76 // m.dumpCompleteManifestHigh(); 78 // m.dumpCompleteManifestHigh();
77 // m.bunchOfTests(); 79 // m.bunchOfTests();
80 }
81
82 // TODO as test in TestCat
83 private void testCatAtCsetRevision() throws Exception {
84 HgCatCommand cmd = new HgCatCommand(hgRepo);
85 cmd.file(Path.create("src/org/tmatesoft/hg/internal/RevlogStream.java"));
86 cmd.changeset(Nodeid.fromAscii("08db726a0fb7914ac9d27ba26dc8bbf6385a0554"));
87 final ByteArrayChannel sink = new ByteArrayChannel();
88 cmd.execute(sink);
89 System.out.println(sink.toArray().length);
78 } 90 }
79 91
80 private void testMergeState() throws Exception { 92 private void testMergeState() throws Exception {
81 final HgMergeState mergeState = hgRepo.getMergeState(); 93 final HgMergeState mergeState = hgRepo.getMergeState();
82 mergeState.refresh(); 94 mergeState.refresh();