##// END OF EJS Templates
hg-core: refactor rev parsing in operations::status_rev_rev...
Mitchell Kember -
r53294:42bd36bb default
parent child Browse files
Show More
@@ -162,22 +162,17 fn parse_revpair(
162 repo: &Repo,
162 repo: &Repo,
163 revs: Option<Vec<String>>,
163 revs: Option<Vec<String>>,
164 ) -> Result<Option<(Revision, Revision)>, CommandError> {
164 ) -> Result<Option<(Revision, Revision)>, CommandError> {
165 let revs = match revs {
165 let Some(revs) = revs else {
166 None => return Ok(None),
166 return Ok(None);
167 Some(revs) => revs,
168 };
167 };
169 if revs.is_empty() {
168 match revs.as_slice() {
170 return Ok(None);
169 [] => Ok(None),
170 [rev1, rev2] => Ok(Some((
171 hg::revset::resolve_single(rev1, repo)?,
172 hg::revset::resolve_single(rev2, repo)?,
173 ))),
174 _ => Err(CommandError::unsupported("expected 0 or 2 --rev flags")),
171 }
175 }
172 if revs.len() != 2 {
173 return Err(CommandError::unsupported("expected 0 or 2 --rev flags"));
174 }
175
176 let rev1 = &revs[0];
177 let rev2 = &revs[1];
178 let rev1 = hg::revset::resolve_single(rev1, repo)?;
179 let rev2 = hg::revset::resolve_single(rev2, repo)?;
180 Ok(Some((rev1, rev2)))
181 }
176 }
182
177
183 /// Pure data type allowing the caller to specify file states to display
178 /// Pure data type allowing the caller to specify file states to display
General Comments 0
You need to be logged in to leave comments. Login now