Currently the package manager kindly defaults to downloading the latest recommended release of a project if you pass it bogus release info. This is convenient, but it would be nice if you could tell it to fail if you pass it bad release info.
This is useful in drupalorg_drush, where we need to verify that a release actually exists as part of building a profile's metadata.
The attached patch simply expands on the functionality of a switch arg, (formally $dev) which certain functions used to restrict operations to development branches. This has been converted to a string arg $restrict_to, with options of 'dev' (old $dev switch enabled), 'version' (new exact version restriction enabled), and '' (old $dev switch disabled).
There were some places where the dev restriction was used besides parsing release XML; in those cases I just made our new arg work like the old.
Patch works to fix the problem in drupalorg_drush, now tossing it over the fence for general consideration.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | drush-pm-restrict-release-version.patch | 7.59 KB | jhedstrom |
| drush-pm-restrict-release-version.patch | 6.9 KB | hunmonk |
Comments
Comment #1
dwwWe need this for #1433784: Fix how drupalorg_drush handles release history XML and propagates data to the packaging script, which is a major bug, so setting the issue metadata a bit more appropriately.
This was a bigger change that I was expecting, but I guess it's good to just consistently clean up $dev. Sadly, I don't have time and bandwidth to do a thorough review and testing. But generally, I'm +1 to the concept of making it possible to restrict the release history searching to a specific release or branch.
Comment #2
moshe weitzman commentedLooks reasonable to me. Lets see if jonhattan or jhedstrom have feedback before this goes in.
Also, needs a test. See releaseInfoCase() for easy unit tests.
Comment #3
jhedstromThis looks good to me. I rerolled with 2 tests.
Comment #4
moshe weitzman commentedLooks good.
Comment #5
jhedstromCommitted.