Mercurial > hg4j
diff 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 |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/core/HgManifestCommand.java Thu Feb 17 05:06:07 2011 +0100 +++ b/src/org/tmatesoft/hg/core/HgManifestCommand.java Thu Feb 17 22:16:25 2011 +0100 @@ -16,6 +16,8 @@ */ package org.tmatesoft.hg.core; +import static org.tmatesoft.hg.repo.HgRepository.*; +import static org.tmatesoft.hg.repo.HgRepository.BAD_REVISION; import static org.tmatesoft.hg.repo.HgRepository.TIP; import java.util.ConcurrentModificationException; @@ -52,8 +54,16 @@ } public HgManifestCommand range(int rev1, int rev2) { - // if manifest range is different from that of changelog, need conversion utils (external?) - throw HgRepository.notImplemented(); + // XXX if manifest range is different from that of changelog, need conversion utils (external?) + boolean badArgs = rev1 == BAD_REVISION || rev2 == BAD_REVISION || rev1 == WORKING_COPY || rev2 == WORKING_COPY; + badArgs |= rev2 != TIP && rev2 < rev1; // range(3, 1); + badArgs |= rev1 == TIP && rev2 != TIP; // range(TIP, 2), although this may be legitimate when TIP points to 2 + if (badArgs) { + throw new IllegalArgumentException(String.format("Bad range: [%d, %d]", rev1, rev2)); + } + startRev = rev1; + endRev = rev2; + return this; } public HgManifestCommand revision(int rev) { @@ -78,7 +88,7 @@ return this; } - public void walk(Handler handler) { + public void execute(Handler handler) { if (handler == null) { throw new IllegalArgumentException(); }