comparison 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
comparison
equal deleted inserted replaced
142:37a34044e6bd 143:b9700740553a
118 */ 118 */
119 public HgStatusCommand revision(int revision) { 119 public HgStatusCommand revision(int revision) {
120 if (revision == BAD_REVISION) { 120 if (revision == BAD_REVISION) {
121 revision = WORKING_COPY; 121 revision = WORKING_COPY;
122 } 122 }
123 // XXX negative values, except for predefined constants, shall throw IAE. 123 if (revision != TIP && revision != WORKING_COPY && revision < 0) {
124 throw new IllegalArgumentException(String.valueOf(revision));
125 }
124 endRevision = revision; 126 endRevision = revision;
125 return this; 127 return this;
128 }
129
130 /**
131 * Shorthand for {@link #base(int) cmd.base(BAD_REVISION)}{@link #change(int) .revision(revision)}
132 *
133 * @param revision compare given revision against its parent
134 * @return
135 */
136 public HgStatusCommand change(int revision) {
137 base(BAD_REVISION);
138 return revision(revision);
126 } 139 }
127 140
128 // pass null to reset 141 // pass null to reset
129 public HgStatusCommand match(Path.Matcher pathMatcher) { 142 public HgStatusCommand match(Path.Matcher pathMatcher) {
130 mediator.matcher = pathMatcher; 143 mediator.matcher = pathMatcher;