Mercurial > jhg
comparison src/org/tmatesoft/hg/core/HgLogCommand.java @ 205:ffc5f6d59f7e
HgLogCommand.Handler is used in few places, pull up to top-level class, HgChangesetHandler
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 28 Apr 2011 02:00:42 +0200 |
parents | c9b305df0b89 |
children | 41a778e3fd31 |
comparison
equal
deleted
inserted
replaced
204:883f1efbcf27 | 205:ffc5f6d59f7e |
---|---|
170 return collector.getChanges(); | 170 return collector.getChanges(); |
171 } | 171 } |
172 | 172 |
173 /** | 173 /** |
174 * | 174 * |
175 * @param inspector | 175 * @param handler callback to process changesets. |
176 * @throws IllegalArgumentException when inspector argument is null | 176 * @throws IllegalArgumentException when inspector argument is null |
177 * @throws ConcurrentModificationException if this log command instance is already running | 177 * @throws ConcurrentModificationException if this log command instance is already running |
178 */ | 178 */ |
179 public void execute(Handler handler) throws HgException { | 179 public void execute(HgChangesetHandler handler) throws HgException { |
180 if (handler == null) { | 180 if (handler == null) { |
181 throw new IllegalArgumentException(); | 181 throw new IllegalArgumentException(); |
182 } | 182 } |
183 if (csetTransform != null) { | 183 if (csetTransform != null) { |
184 throw new ConcurrentModificationException(); | 184 throw new ConcurrentModificationException(); |
257 } | 257 } |
258 return parentHelper; | 258 return parentHelper; |
259 } | 259 } |
260 | 260 |
261 | 261 |
262 public interface Handler { | 262 /** |
263 /** | 263 * @deprecated Use {@link HgChangesetHandler} instead. This interface is left temporarily for compatibility. |
264 * @param changeset not necessarily a distinct instance each time, {@link HgChangeset#clone() clone()} if need a copy. | 264 */ |
265 */ | 265 @Deprecated() |
266 void next(HgChangeset changeset); | 266 public interface Handler extends HgChangesetHandler { |
267 } | 267 } |
268 | 268 |
269 /** | 269 /** |
270 * When {@link HgLogCommand} is executed against file, handler passed to {@link HgLogCommand#execute(Handler)} may optionally | 270 * When {@link HgLogCommand} is executed against file, handler passed to {@link HgLogCommand#execute(HgChangesetHandler)} may optionally |
271 * implement this interface to get information about file renames. Method {@link #copy(FileRevision, FileRevision)} would | 271 * implement this interface to get information about file renames. Method {@link #copy(FileRevision, FileRevision)} would |
272 * get invoked prior any changeset of the original file (if file history being followed) is reported via {@link #next(HgChangeset)}. | 272 * get invoked prior any changeset of the original file (if file history being followed) is reported via {@link #next(HgChangeset)}. |
273 * | 273 * |
274 * For {@link HgLogCommand#file(Path, boolean)} with renamed file path and follow argument set to false, | 274 * For {@link HgLogCommand#file(Path, boolean)} with renamed file path and follow argument set to false, |
275 * {@link #copy(FileRevision, FileRevision)} would be invoked for the first copy/rename in the history of the file, but not | 275 * {@link #copy(FileRevision, FileRevision)} would be invoked for the first copy/rename in the history of the file, but not |
276 * followed by any changesets. | 276 * followed by any changesets. |
277 * | 277 * |
278 * @author Artem Tikhomirov | 278 * @author Artem Tikhomirov |
279 * @author TMate Software Ltd. | 279 * @author TMate Software Ltd. |
280 */ | 280 */ |
281 public interface FileHistoryHandler extends Handler { | 281 public interface FileHistoryHandler extends HgChangesetHandler { |
282 // XXX perhaps, should distinguish copy from rename? And what about merged revisions and following them? | 282 // XXX perhaps, should distinguish copy from rename? And what about merged revisions and following them? |
283 void copy(FileRevision from, FileRevision to); | 283 void copy(FileRevision from, FileRevision to); |
284 } | 284 } |
285 | 285 |
286 public static class CollectHandler implements Handler { | 286 public static class CollectHandler implements HgChangesetHandler { |
287 private final List<HgChangeset> result = new LinkedList<HgChangeset>(); | 287 private final List<HgChangeset> result = new LinkedList<HgChangeset>(); |
288 | 288 |
289 public List<HgChangeset> getChanges() { | 289 public List<HgChangeset> getChanges() { |
290 return Collections.unmodifiableList(result); | 290 return Collections.unmodifiableList(result); |
291 } | 291 } |