Mercurial > hg4j
comparison cmdline/org/tmatesoft/hg/console/Main.java @ 475:0e34b8f3946a
Tests for MqManager
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 12 Jul 2012 16:57:40 +0200 |
parents | 09f2d38ecf26 |
children | 9c9d09111aee |
comparison
equal
deleted
inserted
replaced
474:09f2d38ecf26 | 475:0e34b8f3946a |
---|---|
106 public static void main(String[] args) throws Exception { | 106 public static void main(String[] args) throws Exception { |
107 Main m = new Main(args); | 107 Main m = new Main(args); |
108 // m.checkWalkFileRevisions(); | 108 // m.checkWalkFileRevisions(); |
109 // m.checkSubProgress(); | 109 // m.checkSubProgress(); |
110 // m.checkFileFlags(); | 110 // m.checkFileFlags(); |
111 // m.testMqManager(); | |
112 // m.dumpPhases(); | |
113 // m.buildFileLog(); | 111 // m.buildFileLog(); |
114 // m.testConsoleLog(); | 112 // m.testConsoleLog(); |
115 // m.testTreeTraversal(); | 113 // m.testTreeTraversal(); |
116 // m.testRevisionMap(); | 114 // m.testRevisionMap(); |
117 // m.testSubrepos(); | 115 // m.testSubrepos(); |
129 // m.catCompleteHistory(); | 127 // m.catCompleteHistory(); |
130 // m.dumpCompleteManifestLow(); | 128 // m.dumpCompleteManifestLow(); |
131 // m.dumpCompleteManifestHigh(); | 129 // m.dumpCompleteManifestHigh(); |
132 // m.bunchOfTests(); | 130 // m.bunchOfTests(); |
133 } | 131 } |
134 | 132 |
135 | |
136 // TODO as junit tests in 'default' | |
137 // -R ${system_property:user.home}/hg/test-mq | |
138 private void testMqManager() throws Exception { | |
139 MqManager mqManager = new MqManager(hgRepo); | |
140 mqManager.refresh(); | |
141 int i = 1; | |
142 System.out.println("Complete patch queue:"); | |
143 for (PatchRecord pr : mqManager.getAllKnownPatches()) { | |
144 System.out.printf("#%-3d %s from %s\n", i++, pr.getName(), pr.getPatchLocation()); | |
145 } | |
146 i = 1; | |
147 System.out.println("Patches from the queue already applied to the repo:"); | |
148 for (PatchRecord pr : mqManager.getAppliedPatches()) { | |
149 System.out.printf("#%-3d %s, known as cset:%s\n", i++, pr.getName(), pr.getRevision().shortNotation()); | |
150 } | |
151 boolean allAppliedAreKnown = mqManager.getAllKnownPatches().containsAll(mqManager.getAppliedPatches()); | |
152 System.out.printf("[sanity] allAppliedAreKnown:%b, not yet applied:%d\n", allAppliedAreKnown, mqManager.getQueueSize()); | |
153 Assert.assertTrue(allAppliedAreKnown); | |
154 | |
155 System.out.printf("Queues: %s, active:%s\n", mqManager.getQueueNames(), mqManager.getActiveQueueName()); | |
156 Assert.assertTrue(mqManager.getQueueNames().size() > 1); | |
157 Assert.assertTrue(mqManager.getActiveQueueName().length() > 0); | |
158 } | |
159 | |
160 // hg4j repo | 133 // hg4j repo |
161 public void checkWalkFileRevisions() throws Exception { | 134 public void checkWalkFileRevisions() throws Exception { |
162 // hg --debug manifest --rev 150 | grep cmdline/org/tmatesoft/hg/console/Main.java | 135 // hg --debug manifest --rev 150 | grep cmdline/org/tmatesoft/hg/console/Main.java |
163 hgRepo.getManifest().walkFileRevisions(Path.create("cmdline/org/tmatesoft/hg/console/Main.java"), new ManifestDump(), 100, 150, 200, 210, 300); | 136 hgRepo.getManifest().walkFileRevisions(Path.create("cmdline/org/tmatesoft/hg/console/Main.java"), new ManifestDump(), 100, 150, 200, 210, 300); |
164 } | 137 } |
200 } | 173 } |
201 | 174 |
202 private void checkFileFlags() throws Exception { | 175 private void checkFileFlags() throws Exception { |
203 // ~/hg/test-flags repo | 176 // ~/hg/test-flags repo |
204 // TODO transform to a test once I keep test-flags in test-repos.jar | 177 // TODO transform to a test once I keep test-flags in test-repos.jar |
178 // JAR can't keep symlinks. Perhaps, a solution would be to keep repo without WC and | |
179 // perform an `hg up` before use | |
205 HgDataFile link = hgRepo.getFileNode("file-link"); | 180 HgDataFile link = hgRepo.getFileNode("file-link"); |
206 HgDataFile exec = hgRepo.getFileNode("file-exec"); | 181 HgDataFile exec = hgRepo.getFileNode("file-exec"); |
207 HgDataFile file = hgRepo.getFileNode("regular-file"); | 182 HgDataFile file = hgRepo.getFileNode("regular-file"); |
208 System.out.println("Link: " + link.getFlags(TIP)); | 183 System.out.println("Link: " + link.getFlags(TIP)); |
209 System.out.println("Exec: " + exec.getFlags(TIP)); | 184 System.out.println("Exec: " + exec.getFlags(TIP)); |