File tree 2 files changed +28
-8
lines changed
2 files changed +28
-8
lines changed Original file line number Diff line number Diff line change @@ -54,14 +54,26 @@ fn resolve_crate<'k>(
54
54
}
55
55
56
56
match version {
57
- None => Ok ( ( Some ( name) , embedded_version) ) ,
57
+ None => {
58
+ if embedded_version. starts_with ( 'v' ) {
59
+ Ok ( ( Some ( name) , & embedded_version[ 1 ..] ) )
60
+ } else {
61
+ Ok ( ( Some ( name) , embedded_version) )
62
+ }
63
+ }
58
64
Some ( _) => {
59
65
anyhow:: bail!( "cannot specify both `@{embedded_version}` and `--version`" ) ;
60
66
}
61
67
}
62
68
}
63
69
None => match version {
64
- Some ( version) => Ok ( ( krate, version) ) ,
70
+ Some ( version) => {
71
+ if version. starts_with ( 'v' ) {
72
+ Ok ( ( krate, & version[ 1 ..] ) )
73
+ } else {
74
+ Ok ( ( krate, version) )
75
+ }
76
+ }
65
77
None => {
66
78
anyhow:: bail!( "`--version` is required" ) ;
67
79
}
Original file line number Diff line number Diff line change @@ -73,15 +73,19 @@ fn explicit_version_prefixing_v() {
73
73
. build ( ) ;
74
74
75
75
p. cargo ( "yank --version v0.0.1" )
76
+ . replace_crates_io ( registry. index_url ( ) )
77
+ . run ( ) ;
78
+
79
+ p. cargo ( "yank --undo --version v0.0.1" )
76
80
. replace_crates_io ( registry. index_url ( ) )
77
81
. with_status ( 101 )
78
82
. with_stderr_data ( str![ [ r#"
79
83
[UPDATING] crates.io index
80
- [YANK] foo@v0 .0.1
81
- [ERROR] failed to yank from the registry at [ROOTURL]/api
84
+ Unyank foo@0 .0.1
85
+ [ERROR] failed to undo a yank from the registry at [ROOTURL]/api
82
86
83
87
Caused by:
84
- [37] Could not read a file:// file (Couldn't open file [ROOT]/api/api/v1/crates/foo/v0.0.1/yank)
88
+ EOF while parsing a value at line 1 column 0
85
89
86
90
"# ] ] )
87
91
. run ( ) ;
@@ -185,15 +189,19 @@ fn inline_version_prefixing_v() {
185
189
. build ( ) ;
186
190
187
191
192
+ . replace_crates_io ( registry. index_url ( ) )
193
+ . run ( ) ;
194
+
195
+ p
. cargo ( "yank --undo [email protected] " )
188
196
. replace_crates_io ( registry. index_url ( ) )
189
197
. with_status ( 101 )
190
198
. with_stderr_data ( str![ [ r#"
191
199
[UPDATING] crates.io index
192
- [YANK] foo@v0 .0.1
193
- [ERROR] failed to yank from the registry at [ROOTURL]/api
200
+ Unyank foo@0 .0.1
201
+ [ERROR] failed to undo a yank from the registry at [ROOTURL]/api
194
202
195
203
Caused by:
196
- [37] Could not read a file:// file (Couldn't open file [ROOT]/api/api/v1/crates/foo/v0.0.1/yank)
204
+ EOF while parsing a value at line 1 column 0
197
205
198
206
"# ] ] )
199
207
. run ( ) ;
You can’t perform that action at this time.
0 commit comments