Mercurial > hg4j
comparison cmdline/org/tmatesoft/hg/console/Main.java @ 348:a0864b2892cd
Expose errors reading mercurial control files with exception
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 24 Nov 2011 02:57:03 +0100 |
parents | 58725dd511b3 |
children | 33eaed1ad130 |
comparison
equal
deleted
inserted
replaced
347:8da7ade36c57 | 348:a0864b2892cd |
---|---|
418 HgIgnore ignore = hgRepo.getIgnore(); | 418 HgIgnore ignore = hgRepo.getIgnore(); |
419 for (int i = 0; i < toCheck.length; i++) { | 419 for (int i = 0; i < toCheck.length; i++) { |
420 System.out.println("Ignored " + toCheck[i] + ": " + ignore.isIgnored(Path.create(toCheck[i]))); | 420 System.out.println("Ignored " + toCheck[i] + ": " + ignore.isIgnored(Path.create(toCheck[i]))); |
421 } | 421 } |
422 } | 422 } |
423 | 423 |
424 private void dumpDirstate() { | 424 static class DirstateDump implements HgDirstate.Inspector { |
425 new HgInternals(hgRepo).dumpDirstate(); | 425 private final char[] x = new char[] {'n', 'a', 'r', 'm' }; |
426 | |
427 public boolean next(EntryKind kind, Record entry) { | |
428 System.out.printf("%c %3o%6d %30tc\t\t%s", x[kind.ordinal()], entry.mode(), entry.size(), (long) entry.modificationTime() * 1000, entry.name()); | |
429 if (entry.copySource() != null) { | |
430 System.out.printf(" --> %s", entry.copySource()); | |
431 } | |
432 System.out.println(); | |
433 return true; | |
434 } | |
435 } | |
436 | |
437 private void dumpDirstate() throws Exception { | |
438 new HgInternals(hgRepo).getDirstate().walk(new DirstateDump()); | |
426 HgWorkingCopyStatusCollector wcc = HgWorkingCopyStatusCollector.create(hgRepo, new Path.Matcher.Any()); | 439 HgWorkingCopyStatusCollector wcc = HgWorkingCopyStatusCollector.create(hgRepo, new Path.Matcher.Any()); |
427 wcc.getDirstate().walk(new HgDirstate.Inspector() { | 440 wcc.getDirstate().walk(new HgDirstate.Inspector() { |
428 | 441 |
429 public boolean next(EntryKind kind, Record entry) { | 442 public boolean next(EntryKind kind, Record entry) { |
430 System.out.printf("%s %s\n", kind, entry.name()); | 443 System.out.printf("%s %s\n", kind, entry.name()); |
506 } | 519 } |
507 }); | 520 }); |
508 } | 521 } |
509 | 522 |
510 private void bunchOfTests() throws Exception { | 523 private void bunchOfTests() throws Exception { |
511 HgInternals debug = new HgInternals(hgRepo); | |
512 debug.dumpDirstate(); | |
513 final StatusDump dump = new StatusDump(); | 524 final StatusDump dump = new StatusDump(); |
514 dump.showIgnored = false; | 525 dump.showIgnored = false; |
515 dump.showClean = false; | 526 dump.showClean = false; |
516 HgStatusCollector sc = new HgStatusCollector(hgRepo); | 527 HgStatusCollector sc = new HgStatusCollector(hgRepo); |
517 final int r1 = 0, r2 = 3; | 528 final int r1 = 0, r2 = 3; |