Mercurial > hg4j
comparison cmdline/org/tmatesoft/hg/console/Status.java @ 360:150500515714
Report non-critical errors during status operation to handler/inspector
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Thu, 08 Dec 2011 22:19:27 +0100 |
| parents | 45dc79e545f5 |
| children | 31a89587eb04 |
comparison
equal
deleted
inserted
replaced
| 359:1d9bcab9c50f | 360:150500515714 |
|---|---|
| 30 | 30 |
| 31 import org.tmatesoft.hg.core.HgRepoFacade; | 31 import org.tmatesoft.hg.core.HgRepoFacade; |
| 32 import org.tmatesoft.hg.core.HgStatus; | 32 import org.tmatesoft.hg.core.HgStatus; |
| 33 import org.tmatesoft.hg.core.HgStatus.Kind; | 33 import org.tmatesoft.hg.core.HgStatus.Kind; |
| 34 import org.tmatesoft.hg.core.HgStatusCommand; | 34 import org.tmatesoft.hg.core.HgStatusCommand; |
| 35 import org.tmatesoft.hg.core.HgStatusHandler; | |
| 35 import org.tmatesoft.hg.util.Path; | 36 import org.tmatesoft.hg.util.Path; |
| 36 | 37 |
| 37 /** | 38 /** |
| 38 * | 39 * |
| 39 * @author Artem Tikhomirov | 40 * @author Artem Tikhomirov |
| 66 cmd.ignored(cmdLineOpts.getBoolean("-i", "--ignored")); | 67 cmd.ignored(cmdLineOpts.getBoolean("-i", "--ignored")); |
| 67 } | 68 } |
| 68 // cmd.subrepo(cmdLineOpts.getBoolean("-S", "--subrepos")) | 69 // cmd.subrepo(cmdLineOpts.getBoolean("-S", "--subrepos")) |
| 69 final boolean noStatusPrefix = cmdLineOpts.getBoolean("-n", "--no-status"); | 70 final boolean noStatusPrefix = cmdLineOpts.getBoolean("-n", "--no-status"); |
| 70 final boolean showCopies = cmdLineOpts.getBoolean("-C", "--copies"); | 71 final boolean showCopies = cmdLineOpts.getBoolean("-C", "--copies"); |
| 71 class StatusHandler implements HgStatusCommand.Handler { | 72 class StatusHandler implements HgStatusHandler { |
| 72 | 73 |
| 73 final EnumMap<HgStatus.Kind, List<Path>> data = new EnumMap<HgStatus.Kind, List<Path>>(HgStatus.Kind.class); | 74 final EnumMap<HgStatus.Kind, List<Path>> data = new EnumMap<HgStatus.Kind, List<Path>>(HgStatus.Kind.class); |
| 74 final Map<Path, Path> copies = showCopies ? new HashMap<Path,Path>() : null; | 75 final Map<Path, Path> copies = showCopies ? new HashMap<Path,Path>() : null; |
| 75 | 76 |
| 76 public void handleStatus(HgStatus s) { | 77 public void handleStatus(HgStatus s) { |
| 81 } | 82 } |
| 82 l.add(s.getPath()); | 83 l.add(s.getPath()); |
| 83 if (s.isCopy() && showCopies) { | 84 if (s.isCopy() && showCopies) { |
| 84 copies.put(s.getPath(), s.getOriginalPath()); | 85 copies.put(s.getPath(), s.getOriginalPath()); |
| 85 } | 86 } |
| 87 } | |
| 88 | |
| 89 public void handleError(Path file, org.tmatesoft.hg.util.Status s) { | |
| 90 System.out.printf("FAILURE: %s %s\n", s.getMessage(), file); | |
| 91 s.getException().printStackTrace(System.out); | |
| 86 } | 92 } |
| 87 | 93 |
| 88 public void dump() { | 94 public void dump() { |
| 89 sortAndPrint('M', data.get(Kind.Modified), null); | 95 sortAndPrint('M', data.get(Kind.Modified), null); |
| 90 sortAndPrint('A', data.get(Kind.Added), copies); | 96 sortAndPrint('A', data.get(Kind.Added), copies); |
