Mercurial > hg4j
comparison src/org/tmatesoft/hg/core/HgManifestCommand.java @ 143:b9700740553a
Command line tools parse and respect most of command-line arguments
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 17 Feb 2011 22:16:25 +0100 |
parents | 37a34044e6bd |
children | 1a7a9a20e1f9 |
comparison
equal
deleted
inserted
replaced
142:37a34044e6bd | 143:b9700740553a |
---|---|
14 * the terms of a license other than GNU General Public License | 14 * the terms of a license other than GNU General Public License |
15 * contact TMate Software at support@hg4j.com | 15 * contact TMate Software at support@hg4j.com |
16 */ | 16 */ |
17 package org.tmatesoft.hg.core; | 17 package org.tmatesoft.hg.core; |
18 | 18 |
19 import static org.tmatesoft.hg.repo.HgRepository.*; | |
20 import static org.tmatesoft.hg.repo.HgRepository.BAD_REVISION; | |
19 import static org.tmatesoft.hg.repo.HgRepository.TIP; | 21 import static org.tmatesoft.hg.repo.HgRepository.TIP; |
20 | 22 |
21 import java.util.ConcurrentModificationException; | 23 import java.util.ConcurrentModificationException; |
22 import java.util.LinkedHashMap; | 24 import java.util.LinkedHashMap; |
23 import java.util.LinkedList; | 25 import java.util.LinkedList; |
50 public HgManifestCommand(HgRepository hgRepo) { | 52 public HgManifestCommand(HgRepository hgRepo) { |
51 repo = hgRepo; | 53 repo = hgRepo; |
52 } | 54 } |
53 | 55 |
54 public HgManifestCommand range(int rev1, int rev2) { | 56 public HgManifestCommand range(int rev1, int rev2) { |
55 // if manifest range is different from that of changelog, need conversion utils (external?) | 57 // XXX if manifest range is different from that of changelog, need conversion utils (external?) |
56 throw HgRepository.notImplemented(); | 58 boolean badArgs = rev1 == BAD_REVISION || rev2 == BAD_REVISION || rev1 == WORKING_COPY || rev2 == WORKING_COPY; |
59 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 | |
61 if (badArgs) { | |
62 throw new IllegalArgumentException(String.format("Bad range: [%d, %d]", rev1, rev2)); | |
63 } | |
64 startRev = rev1; | |
65 endRev = rev2; | |
66 return this; | |
57 } | 67 } |
58 | 68 |
59 public HgManifestCommand revision(int rev) { | 69 public HgManifestCommand revision(int rev) { |
60 startRev = endRev = rev; | 70 startRev = endRev = rev; |
61 return this; | 71 return this; |
76 public HgManifestCommand match(Path.Matcher pathMatcher) { | 86 public HgManifestCommand match(Path.Matcher pathMatcher) { |
77 matcher = pathMatcher; | 87 matcher = pathMatcher; |
78 return this; | 88 return this; |
79 } | 89 } |
80 | 90 |
81 public void walk(Handler handler) { | 91 public void execute(Handler handler) { |
82 if (handler == null) { | 92 if (handler == null) { |
83 throw new IllegalArgumentException(); | 93 throw new IllegalArgumentException(); |
84 } | 94 } |
85 if (visitor != null) { | 95 if (visitor != null) { |
86 throw new ConcurrentModificationException(); | 96 throw new ConcurrentModificationException(); |