Skip to content

Commit

Permalink
FIXUP: testing
Browse files Browse the repository at this point in the history
  • Loading branch information
utzig committed Aug 21, 2023
1 parent affb566 commit 1efa942
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions newt/project/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ func (proj *Project) UpgradeIf(
predicate func(r *repo.Repo) bool) error {

// Make sure we have an up to date copy of all `repository.yml` files.
if err := proj.downloadRepositoryYmlFiles(okRepos); err != nil {
if err := proj.downloadRepositoryYmlFiles(noDeps, okRepos); err != nil {
return err
}

Expand All @@ -341,7 +341,7 @@ func (proj *Project) InfoIf(predicate func(r *repo.Repo) bool,

if remote {
// Make sure we have an up to date copy of all `repository.yml` files.
if err := proj.downloadRepositoryYmlFiles(nil); err != nil {
if err := proj.downloadRepositoryYmlFiles(false, nil); err != nil {
return err
}
}
Expand Down Expand Up @@ -438,7 +438,7 @@ func (proj *Project) checkNewtVer() error {
}

// Loads the `repository.yml` file for each depended-on repo. This
func (proj *Project) loadRepoDeps(download bool, okRepos []string) error {
func (proj *Project) loadRepoDeps(download bool, noDeps bool, okRepos []string) error {
seen := map[string]struct{}{}

loadDeps := func(r *repo.Repo) ([]*repo.Repo, error) {
Expand All @@ -447,7 +447,7 @@ func (proj *Project) loadRepoDeps(download bool, okRepos []string) error {
depMap := r.CommitDepMap()
for _, depSlice := range depMap {
for _, dep := range depSlice {
if !isOkRepo(dep.Name, okRepos) {
if noDeps && !isOkRepo(dep.Name, okRepos) {
log.Debugf("Skipping repo %s", dep.Name)
continue
}
Expand Down Expand Up @@ -503,7 +503,8 @@ func (proj *Project) loadRepoDeps(download bool, okRepos []string) error {
return nil
}

func (proj *Project) downloadRepositoryYmlFiles(okRepos []string) error {
func (proj *Project) downloadRepositoryYmlFiles(noDeps bool,
okRepos []string) error {
// Download the `repository.yml` file for each root-level repo (those
// specified in the `project.yml` file).
for _, r := range proj.repos.Sorted() {
Expand All @@ -518,7 +519,7 @@ func (proj *Project) downloadRepositoryYmlFiles(okRepos []string) error {
}

// Download the `repository.yml` file for each depended-on repo.
if err := proj.loadRepoDeps(true, okRepos); err != nil {
if err := proj.loadRepoDeps(true, noDeps, okRepos); err != nil {
return err
}

Expand Down Expand Up @@ -584,7 +585,7 @@ func (proj *Project) addRepo(r *repo.Repo, download bool, isDep bool) error {
return nil
}

func (proj *Project) loadConfig(download bool, okRepos []string) error {
func (proj *Project) loadConfig(download bool, noDeps bool, okRepos []string) error {
yc, err := config.ReadFile(proj.BasePath + "/" + PROJECT_FILE_NAME)
if err != nil {
return util.NewNewtError(err.Error())
Expand Down Expand Up @@ -643,7 +644,7 @@ func (proj *Project) loadConfig(download bool, okRepos []string) error {
// Read `repository.yml` files belonging to dependee repos from disk.
// These repos might not be specified in the `project.yml` file, but they
// are still part of the project.
if err := proj.loadRepoDeps(download, okRepos); err != nil {
if err := proj.loadRepoDeps(download, noDeps, okRepos); err != nil {
return err
}

Expand Down Expand Up @@ -690,7 +691,7 @@ func (proj *Project) Init(dir string, download bool, okRepos []string) error {
proj.rootRepoReqs = map[string]newtutil.RepoVersion{}

// Load Project configuration
if err := proj.loadConfig(download, okRepos); err != nil {
if err := proj.loadConfig(download, false, okRepos); err != nil {
return err
}

Expand Down

0 comments on commit 1efa942

Please sign in to comment.