diff src/org/tmatesoft/hg/core/HgStatusCommand.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 4a948ec83980
children 1a7a9a20e1f9
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/core/HgStatusCommand.java	Thu Feb 17 05:06:07 2011 +0100
+++ b/src/org/tmatesoft/hg/core/HgStatusCommand.java	Thu Feb 17 22:16:25 2011 +0100
@@ -120,11 +120,24 @@
 		if (revision == BAD_REVISION) {
 			revision = WORKING_COPY;
 		}
-		// XXX negative values, except for predefined constants, shall throw IAE.
+		if (revision != TIP && revision != WORKING_COPY && revision < 0) {
+			throw new IllegalArgumentException(String.valueOf(revision));
+		}
 		endRevision = revision;
 		return this;
 	}
 	
+	/**
+	 * Shorthand for {@link #base(int) cmd.base(BAD_REVISION)}{@link #change(int) .revision(revision)}
+	 *  
+	 * @param revision compare given revision against its parent
+	 * @return
+	 */
+	public HgStatusCommand change(int revision) {
+		base(BAD_REVISION);
+		return revision(revision);
+	}
+	
 	// pass null to reset
 	public HgStatusCommand match(Path.Matcher pathMatcher) {
 		mediator.matcher = pathMatcher;