// 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/lib/protobuf/forgepb" "go.wit.com/log" ) // FORGE USES THESE TO RECOVER FROM WHEN TOOLKITS FAIL TO LOAD // so don't delete them func doDev() (string, error) { if argv.Dev.DeleteUser { setForgeMode(forgepb.ForgeMode_MASTER) for repo := range me.forge.Repos.IterByNamespace() { if !repo.IsBranchRemote(repo.GetUserBranchName()) { continue } // log.Info("delete remote user", repo.FullPath) localtag := repo.IsBranchLocal(repo.GetUserBranchName()) if localtag == nil { log.Info("no local user", repo.FullPath) continue } // log.Info("local user", repo.FullPath) hashes, err := repo.DeleteLocalBranch(repo.GetUserBranchName()) if err != nil { // log.Info("LOCAL BRANCH NOT SAFE. COMPARE WITH DEVEL", err, repo.FullPath) } else if hashes == nil { log.Info("LOCAL SAFE TO DELETE", repo.FullPath) continue } uref := repo.GetLocalUserRef() dref := repo.GetLocalDevelRef() // try compare against devel uver := repo.NewCompareRef(uref) dver := repo.NewCompareRef(dref) hashok, hashbad, err := dver.DeleteBranch(uver) if err == nil { for _, line := range hashok { log.Info("SAFE hashok", line) } for _, line := range hashbad { log.Info("NOT SAFE hashbad", line) } log.Info("SAFE TO DELETE uver from dver", uref.Refname, dref.Refname, repo.FullPath) continue } for _, line := range hashok { log.Info("SAFE hashok", line) } for _, line := range hashbad { log.Info("NOT SAFE hashbad", line) } log.Info("NOT SAFE TO DELETE uver from dver", uref.Refname, dref.Refname, repo.FullPath, err) } } return "", nil }