Pkg2.{checkout,release}: factor out a little common checkout code.