File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ struct Cli {
146146 #[ clap( flatten) ]
147147 options : Options ,
148148 /// Refs. to the revision at the tip of TreeHerder push(es), of the form
149- /// `<project>:<hash>`.
149+ /// `[ <project>:] <hash>`.
150150 #[ clap( value_parser = RevisionRef :: from_str) ]
151151 revisions : Vec < RevisionRef > ,
152152}
@@ -179,12 +179,21 @@ impl FromStr for RevisionRef {
179179 type Err = & ' static str ;
180180
181181 fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
182- s. split_once ( ':' )
183- . map ( |( project, hash) | Self {
184- project : project. to_owned ( ) ,
185- hash : hash. to_owned ( ) ,
186- } )
187- . ok_or ( "no dividing colon found; expected revision ref. of the form <project>:<hash>" )
182+ let project;
183+ let hash;
184+
185+ if let Some ( ( p, h) ) = s. split_once ( ':' ) {
186+ project = p;
187+ hash = h;
188+ } else {
189+ project = "try" ;
190+ hash = s;
191+ }
192+
193+ Ok ( Self {
194+ project : project. to_owned ( ) ,
195+ hash : hash. to_owned ( ) ,
196+ } )
188197 }
189198}
190199
You can’t perform that action at this time.
0 commit comments