func (p *protector) UpdateRepo(orgName string, repoName string, repo config.Repo) error {
	p.completedRepos[orgName+"/"+repoName] = true

	githubRepo, err := p.client.GetRepo(orgName, repoName)
	if err != nil {
		return fmt.Errorf("could not get repo to check for archival: %v", err)
	}
	if githubRepo.Archived {
		// nothing to do
		return nil
	}

	branches := map[string]github.Branch{}
	for _, onlyProtected := range []bool{false, true} { // put true second so b.Protected is set correctly
		bs, err := p.client.GetBranches(orgName, repoName, onlyProtected)
		if err != nil {
			return fmt.Errorf("list branches: %v", err)
		}
		for _, b := range bs {
			branches[b.Name] = b
		}
	}

	for bn, githubBranch := range branches {
		if branch, err := repo.GetBranch(bn); err != nil {
			return fmt.Errorf("get %s: %v", bn, err)
		} else if err = p.UpdateBranch(orgName, repoName, bn, *branch, githubBranch.Protected); err != nil {
			return fmt.Errorf("update %s from protected=%t: %v", bn, githubBranch.Protected, err)
		}
	}
	return nil
}
func (p *protector) UpdateRepo(orgName string, repoName string, repo config.Repo) error {
	p.completedRepos[orgName+"/"+repoName] = true

	githubRepo, err := p.client.GetRepo(orgName, repoName)
	if err != nil {
		return fmt.Errorf("could not get repo to check for archival: %v", err)
	}
	if githubRepo.Archived {
		
		return nil
	}

	branches := map[string]github.Branch{}
	for _, onlyProtected := range []bool{false, true} { 
		bs, err := p.client.GetBranches(orgName, repoName, onlyProtected)
		if err != nil {
			return fmt.Errorf("list branches: %v", err)
		}
		for _, b := range bs {
			branches[b.Name] = b
		}
	}

	for bn, githubBranch := range branches {
		if branch, err := repo.GetBranch(bn); err != nil {
			return fmt.Errorf("get %s: %v", bn, err)
		} else if err = p.UpdateBranch(orgName, repoName, bn, *branch, githubBranch.Protected); err != nil {
			return fmt.Errorf("update %s from protected=%t: %v", bn, githubBranch.Protected, err)
		}
	}
	return nil
}
func ( p * protector ) UpdateRepo ( orgName string , repoName string , repo config . Repo ) error { p . completedRepos [ orgName + " " + repoName ] = true githubRepo , err := p . client . GetRepo ( orgName , repoName ) if err != nil { return fmt . Errorf ( " " , err ) } if githubRepo . Archived { // nothing to do return nil } branches := map [ string ] github . Branch { } for _ , onlyProtected := range [ ] bool { false , true } { // put true second so b.Protected is set correctly bs , err := p . client . GetBranches ( orgName , repoName , onlyProtected ) if err != nil { return fmt . Errorf ( " " , err ) } for _ , b := range bs { branches [ b . Name ] = b } } for bn , githubBranch := range branches { if branch , err := repo . GetBranch ( bn ) ; err != nil { return fmt . Errorf ( " " , bn , err ) } else if err = p . UpdateBranch ( orgName , repoName , bn , * branch , githubBranch . Protected ) ; err != nil { return fmt . Errorf ( " " , bn , githubBranch . Protected , err ) } } return nil }
// UpdateRepo updates all branches in the repo with the specified defaults
UpdateRepo updates all branches in the repo with the specified defaults