comparison test/org/tmatesoft/hg/test/TestAuxUtilities.java @ 445:d0e5dc3cae6e smartgit3

Support for phases functionality from Mercurial 2.1
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Tue, 05 Jun 2012 20:50:06 +0200
parents 2fadf8695f8a
children 2e402c12ebc6
comparison
equal deleted inserted replaced
412:63c5a9d7ca3f 445:d0e5dc3cae6e
242 } catch (HgException ex) { 242 } catch (HgException ex) {
243 Assert.fail(ex.toString()); 243 Assert.fail(ex.toString());
244 } 244 }
245 } 245 }
246 }); 246 });
247 fileNode.walk(0, TIP, new HgDataFile.ParentInspector() { 247 class ParentInspectorCheck implements HgDataFile.ParentInspector {
248 int i = 0; 248 private int i;
249 Nodeid[] all = new Nodeid[fileNode.getRevisionCount()]; 249 private Nodeid[] all;
250
251 public ParentInspectorCheck(int start, int total) {
252 i = start;
253 all = new Nodeid[total];
254 }
250 255
251 public void next(int localRevision, Nodeid revision, int parent1, int parent2, Nodeid nidParent1, Nodeid nidParent2) { 256 public void next(int localRevision, Nodeid revision, int parent1, int parent2, Nodeid nidParent1, Nodeid nidParent2) {
252 Assert.assertEquals(i++, localRevision); 257 Assert.assertEquals(i++, localRevision);
253 all[localRevision] = revision; 258 all[localRevision] = revision;
254 Assert.assertNotNull(revision); 259 Assert.assertNotNull(revision);
262 if (parent2 != -1) { 267 if (parent2 != -1) {
263 Assert.assertNotNull(nidParent2); 268 Assert.assertNotNull(nidParent2);
264 Assert.assertTrue(nidParent2 == all[parent2]); 269 Assert.assertTrue(nidParent2 == all[parent2]);
265 } 270 }
266 } 271 }
267 }); 272 };
273 fileNode.walk(0, TIP, new ParentInspectorCheck(0, fileNode.getRevisionCount()));
274 assert fileNode.getRevisionCount() > 2 : "prereq"; // need at least few revisions
275 // there used to be a defect in #walk impl, assumption all parents come prior to a revision
276 fileNode.walk(1, 3, new ParentInspectorCheck(1, 3));
268 } 277 }
269 278
270 @Test 279 @Test
271 @Ignore("just a dump for now, to compare values visually") 280 @Ignore("just a dump for now, to compare values visually")
272 public void testRepositoryConfig() throws Exception { 281 public void testRepositoryConfig() throws Exception {