@@ -67,8 +67,8 @@ pub struct PackageSelectOptions {
67
67
/// and attempts to identify the packages and its dependents through that mechanism. You
68
68
/// can use any `tag`, `branch` or `commit`, but you must be sure it is available
69
69
/// (and up to date) locally.
70
- #[ structopt( short, long) ]
71
- pub changed_since : String ,
70
+ #[ structopt( short, long, name = "git-ref" ) ]
71
+ pub changed_since : Option < String > ,
72
72
}
73
73
74
74
#[ derive( StructOpt , Debug ) ]
@@ -366,24 +366,15 @@ fn make_pkg_predicate(ws: &Workspace<'_>, args: PackageSelectOptions) -> Result<
366
366
. into ( ) ,
367
367
) ;
368
368
}
369
- if changed_since. len ( ) != 0 {
369
+ if changed_since. as_ref ( ) . map_or ( false , |git_ref| !git_ref . is_empty ( ) ) {
370
370
return Err (
371
371
"-p/--packages is mutually exlusive to using -c/--changed-since"
372
372
. into ( ) ,
373
373
) ;
374
374
}
375
375
}
376
376
377
- let publish = move |p : & Package | {
378
- // If publish is set to false or any registry, it is ignored by default
379
- // unless overriden.
380
- let value = ignore_publish || p. publish ( ) . is_none ( ) ;
381
-
382
- trace ! ( "{:}.publish={}" , p. name( ) , value) ;
383
- value
384
- } ;
385
-
386
- if changed_since. len ( ) != 0 {
377
+ if changed_since. as_ref ( ) . map_or ( false , |git_ref| !git_ref. is_empty ( ) ) {
387
378
if !skip. is_empty ( ) || !ignore_pre_version. is_empty ( ) {
388
379
return Err (
389
380
"-c/--changed-since is mutually exlusive to using -s/--skip and -i/--ignore-version-pre"
@@ -393,9 +384,29 @@ fn make_pkg_predicate(ws: &Workspace<'_>, args: PackageSelectOptions) -> Result<
393
384
394
385
}
395
386
396
- let changed = util:: changed_packages ( ws, & changed_since) ?;
397
- if changed. len ( ) == 0 {
398
- return Err ( "No changes detected" . into ( ) )
387
+ // Either use explicitly given --packages or calculate packages that were
388
+ // --changed-since a given Git reference.
389
+ let packages = match changed_since {
390
+ Some ( git_ref) if !git_ref. is_empty ( ) => {
391
+ let changed = util:: changed_packages ( ws, & git_ref) ?;
392
+
393
+ if changed. len ( ) == 0 {
394
+ return Err ( "No changes detected" . into ( ) )
395
+ } ;
396
+
397
+ changed. iter ( ) . map ( Package :: name) . collect ( )
398
+ }
399
+ _ => packages,
400
+ } ;
401
+
402
+
403
+ let publish = move |p : & Package | {
404
+ // If publish is set to false or any registry, it is ignored by default
405
+ // unless overriden.
406
+ let value = ignore_publish || p. publish ( ) . is_none ( ) ;
407
+
408
+ trace ! ( "{:}.publish={}" , p. name( ) , value) ;
409
+ value
399
410
} ;
400
411
401
412
if !packages. is_empty ( ) {
0 commit comments