Mercurial > hg4j
comparison src/org/tmatesoft/hg/core/HgManifestCommand.java @ 423:9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Fri, 23 Mar 2012 22:51:18 +0100 |
parents | ee8264d80747 |
children | 6437d261048a |
comparison
equal
deleted
inserted
replaced
422:5d1cc7366d04 | 423:9c9c442b5f2e |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2011 TMate Software Ltd | 2 * Copyright (c) 2011-2012 TMate Software Ltd |
3 * | 3 * |
4 * This program is free software; you can redistribute it and/or modify | 4 * This program is free software; you can redistribute it and/or modify |
5 * it under the terms of the GNU General Public License as published by | 5 * it under the terms of the GNU General Public License as published by |
6 * the Free Software Foundation; version 2 of the License. | 6 * the Free Software Foundation; version 2 of the License. |
7 * | 7 * |
23 import java.util.ConcurrentModificationException; | 23 import java.util.ConcurrentModificationException; |
24 import java.util.LinkedHashMap; | 24 import java.util.LinkedHashMap; |
25 import java.util.LinkedList; | 25 import java.util.LinkedList; |
26 import java.util.List; | 26 import java.util.List; |
27 | 27 |
28 import org.tmatesoft.hg.internal.Callback; | |
28 import org.tmatesoft.hg.repo.HgManifest; | 29 import org.tmatesoft.hg.repo.HgManifest; |
29 import org.tmatesoft.hg.repo.HgRepository; | 30 import org.tmatesoft.hg.repo.HgRepository; |
30 import org.tmatesoft.hg.repo.HgManifest.Flags; | 31 import org.tmatesoft.hg.repo.HgManifest.Flags; |
31 import org.tmatesoft.hg.util.Path; | 32 import org.tmatesoft.hg.util.Path; |
32 import org.tmatesoft.hg.util.PathPool; | 33 import org.tmatesoft.hg.util.PathPool; |
119 } | 120 } |
120 | 121 |
121 /** | 122 /** |
122 * Callback to walk file/directory tree of a revision | 123 * Callback to walk file/directory tree of a revision |
123 */ | 124 */ |
124 public interface Handler { | 125 @Callback |
126 public interface Handler { // FIXME TLC | |
125 void begin(Nodeid manifestRevision); | 127 void begin(Nodeid manifestRevision); |
126 void dir(Path p); // optionally invoked (if walker was configured to spit out directories) prior to any files from this dir and subdirs | 128 void dir(Path p); // optionally invoked (if walker was configured to spit out directories) prior to any files from this dir and subdirs |
127 void file(HgFileRevision fileRevision); // XXX allow to check p is invalid (df.exists()) | 129 void file(HgFileRevision fileRevision); // XXX allow to check p is invalid (df.exists()) |
128 void end(Nodeid manifestRevision); | 130 void end(Nodeid manifestRevision); |
129 } | 131 } |
178 visitor.end(manifestNodeid); | 180 visitor.end(manifestNodeid); |
179 manifestNodeid = null; | 181 manifestNodeid = null; |
180 return true; | 182 return true; |
181 } | 183 } |
182 public boolean next(Nodeid nid, String fname, String flags) { | 184 public boolean next(Nodeid nid, String fname, String flags) { |
183 throw new HgBadStateException(HgManifest.Inspector2.class.getName()); | 185 throw new IllegalStateException(HgManifest.Inspector2.class.getName()); |
184 } | 186 } |
185 | 187 |
186 public boolean next(Nodeid nid, Path fname, Flags flags) { | 188 public boolean next(Nodeid nid, Path fname, Flags flags) { |
187 if (matcher != null && !matcher.accept(fname)) { | 189 if (matcher != null && !matcher.accept(fname)) { |
188 return true; | 190 return true; |