Mercurial > hg4j
comparison cmdline/org/tmatesoft/hg/console/Main.java @ 248:3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Fri, 12 Aug 2011 18:48:57 +0200 |
parents | 4b661efb9374 |
children | 4c3b9f679412 |
comparison
equal
deleted
inserted
replaced
247:f052f40839ec | 248:3fbfce107f94 |
---|---|
21 import java.util.ArrayList; | 21 import java.util.ArrayList; |
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.junit.Assert; | |
26 import org.tmatesoft.hg.core.HgLogCommand; | 27 import org.tmatesoft.hg.core.HgLogCommand; |
27 import org.tmatesoft.hg.core.HgLogCommand.FileRevision; | 28 import org.tmatesoft.hg.core.HgLogCommand.FileRevision; |
28 import org.tmatesoft.hg.core.HgCatCommand; | 29 import org.tmatesoft.hg.core.HgCatCommand; |
30 import org.tmatesoft.hg.core.HgFileInformer; | |
29 import org.tmatesoft.hg.core.HgFileRevision; | 31 import org.tmatesoft.hg.core.HgFileRevision; |
30 import org.tmatesoft.hg.core.HgManifestCommand; | 32 import org.tmatesoft.hg.core.HgManifestCommand; |
31 import org.tmatesoft.hg.core.Nodeid; | 33 import org.tmatesoft.hg.core.Nodeid; |
32 import org.tmatesoft.hg.internal.ByteArrayChannel; | 34 import org.tmatesoft.hg.internal.ByteArrayChannel; |
33 import org.tmatesoft.hg.internal.DigestHelper; | 35 import org.tmatesoft.hg.internal.DigestHelper; |
75 // m.testRevisionMap(); | 77 // m.testRevisionMap(); |
76 // m.testSubrepos(); | 78 // m.testSubrepos(); |
77 // m.testReadWorkingCopy(); | 79 // m.testReadWorkingCopy(); |
78 // m.testParents(); | 80 // m.testParents(); |
79 // m.testEffectiveFileLog(); | 81 // m.testEffectiveFileLog(); |
80 // m.testCatAtCsetRevision(); | 82 m.testCatAtCsetRevision(); |
81 // m.testMergeState(); | 83 // m.testMergeState(); |
82 // m.testFileStatus(); | 84 // m.testFileStatus(); |
83 m.dumpBranches(); | 85 // m.dumpBranches(); |
84 // m.inflaterLengthException(); | 86 // m.inflaterLengthException(); |
85 // m.dumpIgnored(); | 87 // m.dumpIgnored(); |
86 // m.dumpDirstate(); | 88 // m.dumpDirstate(); |
87 // m.testStatusInternals(); | 89 // m.testStatusInternals(); |
88 // m.catCompleteHistory(); | 90 // m.catCompleteHistory(); |
204 } | 206 } |
205 | 207 |
206 // TODO as test in TestCat | 208 // TODO as test in TestCat |
207 private void testCatAtCsetRevision() throws Exception { | 209 private void testCatAtCsetRevision() throws Exception { |
208 HgCatCommand cmd = new HgCatCommand(hgRepo); | 210 HgCatCommand cmd = new HgCatCommand(hgRepo); |
209 cmd.file(Path.create("src/org/tmatesoft/hg/internal/RevlogStream.java")); | 211 final Path file = Path.create("src/org/tmatesoft/hg/internal/RevlogStream.java"); |
210 cmd.changeset(Nodeid.fromAscii("08db726a0fb7914ac9d27ba26dc8bbf6385a0554")); | 212 cmd.file(file); |
213 final Nodeid cset = Nodeid.fromAscii("08db726a0fb7914ac9d27ba26dc8bbf6385a0554"); | |
214 cmd.changeset(cset); | |
211 final ByteArrayChannel sink = new ByteArrayChannel(); | 215 final ByteArrayChannel sink = new ByteArrayChannel(); |
212 cmd.execute(sink); | 216 cmd.execute(sink); |
213 System.out.println(sink.toArray().length); | 217 System.out.println(sink.toArray().length); |
218 HgFileInformer i = new HgFileInformer(hgRepo); | |
219 boolean result = i.changeset(cset).check(file); | |
220 Assert.assertFalse(result); | |
221 Assert.assertFalse(i.exists()); | |
222 result = i.followRenames(true).check(file); | |
223 Assert.assertTrue(result); | |
224 Assert.assertTrue(i.exists()); | |
225 HgCatCommand cmd2 = new HgCatCommand(hgRepo).revision(i.getFileRevision()); | |
226 final ByteArrayChannel sink2 = new ByteArrayChannel(); | |
227 cmd2.execute(sink2); | |
228 System.out.println(sink2.toArray().length); | |
229 Assert.assertEquals(sink.toArray().length, sink2.toArray().length); | |
214 } | 230 } |
215 | 231 |
216 private void testMergeState() throws Exception { | 232 private void testMergeState() throws Exception { |
217 final HgMergeState mergeState = hgRepo.getMergeState(); | 233 final HgMergeState mergeState = hgRepo.getMergeState(); |
218 mergeState.refresh(); | 234 mergeState.refresh(); |