comparison cmdline/org/tmatesoft/hg/console/Main.java @ 442:6865eb742883

Tests for subrepo API, refactor status tests for reuse, better subrepos API
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 27 Apr 2012 20:57:20 +0200
parents be697c3e951e
children 909306e412e2
comparison
equal deleted inserted replaced
441:2a08466838d3 442:6865eb742883
95 System.out.println("REPO:" + hgRepo.getLocation()); 95 System.out.println("REPO:" + hgRepo.getLocation());
96 } 96 }
97 97
98 public static void main(String[] args) throws Exception { 98 public static void main(String[] args) throws Exception {
99 Main m = new Main(args); 99 Main m = new Main(args);
100 m.checkWalkFileRevisions(); 100 // m.checkWalkFileRevisions();
101 // m.checkSubProgress(); 101 // m.checkSubProgress();
102 // m.checkFileFlags(); 102 // m.checkFileFlags();
103 // m.buildFileLog(); 103 // m.buildFileLog();
104 // m.testConsoleLog(); 104 // m.testConsoleLog();
105 // m.testTreeTraversal(); 105 // m.testTreeTraversal();
106 // m.testRevisionMap(); 106 // m.testRevisionMap();
107 // m.testSubrepos(); 107 m.testSubrepos();
108 // m.testReadWorkingCopy(); 108 // m.testReadWorkingCopy();
109 // m.testParents(); 109 // m.testParents();
110 // m.testEffectiveFileLog(); 110 // m.testEffectiveFileLog();
111 // m.testCatAtCsetRevision(); 111 // m.testCatAtCsetRevision();
112 // m.testMergeState(); 112 // m.testMergeState();
316 System.out.println(System.currentTimeMillis() - start); 316 System.out.println(System.currentTimeMillis() - start);
317 System.out.printf("\t from that, init took %d ms\n", s2 - start); 317 System.out.printf("\t from that, init took %d ms\n", s2 - start);
318 318
319 } 319 }
320 320
321 // any repository with subrepositories
321 private void testSubrepos() throws Exception { 322 private void testSubrepos() throws Exception {
323 // @see TestSubrepo#testAccessAPI
322 for (HgSubrepoLocation l : hgRepo.getSubrepositories()) { 324 for (HgSubrepoLocation l : hgRepo.getSubrepositories()) {
323 System.out.println(l.getLocation()); 325 System.out.println(l.getLocation());
324 System.out.println(l.getSource()); 326 System.out.println(l.getSource());
325 System.out.println(l.getType()); 327 System.out.println(l.getType());
326 System.out.println(l.isCommitted() ? l.getRevision() : "not yet committed"); 328 System.out.println(l.isCommitted() ? l.getRevision() : "not yet committed");
327 if (l.getType() == Kind.Hg) { 329 if (l.getType() == Kind.Hg) {
328 HgRepository r = l.getRepo(); 330 HgRepository r = l.getRepo();
329 System.out.printf("%s has %d revisions\n", l.getLocation(), r.getChangelog().getLastRevision() + 1); 331 System.out.printf("%s (%s) has %d revisions\n", l.getLocation(), r.getLocation(), r.getChangelog().getLastRevision() + 1);
330 if (r.getChangelog().getLastRevision() >= 0) { 332 if (r.getChangelog().getLastRevision() >= 0) {
331 final RawChangeset c = r.getChangelog().range(TIP, TIP).get(0); 333 final RawChangeset c = r.getChangelog().range(TIP, TIP).get(0);
332 System.out.printf("TIP: %s %s %s\n", c.user(), c.dateString(), c.comment()); 334 System.out.printf("TIP: %s %s '%s'\n", c.user(), c.dateString(), c.comment());
333 } 335 }
334 } 336 }
335 } 337 }
336 } 338 }
337 339