comparison src/org/tmatesoft/hg/core/HgManifestCommand.java @ 148:1a7a9a20e1f9

Exceptions, javadoc. Initial cancel and progress support
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 23 Feb 2011 22:36:28 +0100
parents b9700740553a
children 41a778e3fd31
comparison
equal deleted inserted replaced
147:a05145db4d0c 148:1a7a9a20e1f9
51 51
52 public HgManifestCommand(HgRepository hgRepo) { 52 public HgManifestCommand(HgRepository hgRepo) {
53 repo = hgRepo; 53 repo = hgRepo;
54 } 54 }
55 55
56 /**
57 * Parameterize command to visit revisions <code>[rev1..rev2]</code>.
58 * @param rev1 - local revision number to start from. Non-negative. May be {@link HgRepository#TIP} (rev2 argument shall be {@link HgRepository#TIP} as well, then)
59 * @param rev2 - local revision number to end with, inclusive. Non-negative, greater or equal to rev1. May be {@link HgRepository#TIP}.
60 * @return <code>this</code> for convenience.
61 * @throws IllegalArgumentException if revision arguments are incorrect (see above).
62 */
56 public HgManifestCommand range(int rev1, int rev2) { 63 public HgManifestCommand range(int rev1, int rev2) {
57 // XXX if manifest range is different from that of changelog, need conversion utils (external?) 64 // XXX if manifest range is different from that of changelog, need conversion utils (external?)
58 boolean badArgs = rev1 == BAD_REVISION || rev2 == BAD_REVISION || rev1 == WORKING_COPY || rev2 == WORKING_COPY; 65 boolean badArgs = rev1 == BAD_REVISION || rev2 == BAD_REVISION || rev1 == WORKING_COPY || rev2 == WORKING_COPY;
59 badArgs |= rev2 != TIP && rev2 < rev1; // range(3, 1); 66 badArgs |= rev2 != TIP && rev2 < rev1; // range(3, 1);
60 badArgs |= rev1 == TIP && rev2 != TIP; // range(TIP, 2), although this may be legitimate when TIP points to 2 67 badArgs |= rev1 == TIP && rev2 != TIP; // range(TIP, 2), although this may be legitimate when TIP points to 2
86 public HgManifestCommand match(Path.Matcher pathMatcher) { 93 public HgManifestCommand match(Path.Matcher pathMatcher) {
87 matcher = pathMatcher; 94 matcher = pathMatcher;
88 return this; 95 return this;
89 } 96 }
90 97
98 /**
99 * Runs the command.
100 * @param handler - callback to get the outcome
101 * @throws IllegalArgumentException if handler is <code>null</code>
102 * @throws ConcurrentModificationException if this command is already in use (running)
103 */
91 public void execute(Handler handler) { 104 public void execute(Handler handler) {
92 if (handler == null) { 105 if (handler == null) {
93 throw new IllegalArgumentException(); 106 throw new IllegalArgumentException();
94 } 107 }
95 if (visitor != null) { 108 if (visitor != null) {