// Copyright 2017-2025 WIT.COM Inc. All rights reserved. // Use of this source code is governed by the GPL 3.0 package main import ( "go.wit.com/log" ) func defaultBehavior() error { // always run dirty first me.forge.CheckDirtyQuiet() // if no option is given to patch, list out the // repos that have patches ready in them found := findReposWithPatches() if found.Len() == 0 { log.Info("you currently have no repos with patches") return log.Errorf("no repos to publish") } // check if any are dirty for repo := range found.IterAll() { if repo.CheckDirty() { return log.Errorf("%s repo is dirty", repo.FullPath) } } // check the hashes for repo := range found.IterAll() { if err := hashesMatch(repo); err != nil { return err } } // move them all the the master branch var bad bool for repo := range found.IterAll() { if repo.GetCurrentBranchName() != repo.GetMasterBranchName() { repo.CheckoutMaster() bad = true } } if bad { return log.Errorf("some repos had to be switched to the master branch") } if !argv.Force { return log.Errorf("notsure. it might be safe to publish(?)") } return nil } func defaultBehaviorMaster() error { // always run dirty first me.forge.CheckDirtyQuiet() // if no option is given to patch, list out the // repos that have patches ready in them found := findReposWithPatches() if found.Len() == 0 { log.Info("you currently have no repos with patches") return nil } // warn about dirty repos not in master branches for repo := range found.IterAll() { if repo.CheckDirty() { if repo.GetCurrentBranchName() != repo.GetUserBranchName() { repo.State = "DIRTY REPO NOT IN USER BRANCH" } // return log.Errorf("%s repo is dirty", repo.FullPath) } } me.forge.PrintDefaultTB(found) return nil }