@@ -21,14 +21,13 @@ import (
2121 "strings"
2222
2323 "github.com/googleapis/librarian/internal/config"
24- "github.com/googleapis/librarian/internal/conventionalcommits"
2524 "github.com/googleapis/librarian/internal/gitrepo"
2625 "github.com/googleapis/librarian/internal/semver"
2726)
2827
2928// getConventionalCommitsSinceLastRelease returns all conventional commits for the given library since the
3029// version specified in the state file. The repo should be the language repo.
31- func getConventionalCommitsSinceLastRelease (repo gitrepo.Repository , library * config.LibraryState , tag string ) ([]* conventionalcommits .ConventionalCommit , error ) {
30+ func getConventionalCommitsSinceLastRelease (repo gitrepo.Repository , library * config.LibraryState , tag string ) ([]* gitrepo .ConventionalCommit , error ) {
3231 commits , err := repo .GetCommitsForPathsSinceTag (library .SourceRoots , tag )
3332
3433 if err != nil {
@@ -59,10 +58,10 @@ func shouldIncludeForRelease(files, sourceRoots, excludePaths []string) bool {
5958// getConventionalCommitsSinceLastGeneration returns all conventional commits for
6059// all API paths in given library since the last generation. The repo input should
6160// be the googleapis source repo.
62- func getConventionalCommitsSinceLastGeneration (sourceRepo , languageRepo gitrepo.Repository , library * config.LibraryState , lastGenCommit string ) ([]* conventionalcommits .ConventionalCommit , error ) {
61+ func getConventionalCommitsSinceLastGeneration (sourceRepo , languageRepo gitrepo.Repository , library * config.LibraryState , lastGenCommit string ) ([]* gitrepo .ConventionalCommit , error ) {
6362 if lastGenCommit == "" {
6463 slog .Info ("the last generation commit is empty, skip fetching conventional commits" , "library" , library .ID )
65- return make ([]* conventionalcommits .ConventionalCommit , 0 ), nil
64+ return make ([]* gitrepo .ConventionalCommit , 0 ), nil
6665 }
6766
6867 apiPaths := make ([]string , 0 )
@@ -131,8 +130,8 @@ func shouldIncludeForGeneration(sourceFiles, languageRepoFiles []string, library
131130}
132131
133132// libraryFilter filters a list of conventional commits by library ID.
134- func libraryFilter (commits []* conventionalcommits .ConventionalCommit , libraryID string ) []* conventionalcommits .ConventionalCommit {
135- var filteredCommits []* conventionalcommits .ConventionalCommit
133+ func libraryFilter (commits []* gitrepo .ConventionalCommit , libraryID string ) []* gitrepo .ConventionalCommit {
134+ var filteredCommits []* gitrepo .ConventionalCommit
136135 for _ , commit := range commits {
137136 if libraryIDs , ok := commit .Footers ["Library-IDs" ]; ok {
138137 ids := strings .Split (libraryIDs , "," )
@@ -152,8 +151,8 @@ func libraryFilter(commits []*conventionalcommits.ConventionalCommit, libraryID
152151// convertToConventionalCommits converts a list of commits in a git repo into a list
153152// of conventional commits. The filesFilter parameter is custom filter out non-matching
154153// files depending on a generation or a release change.
155- func convertToConventionalCommits (sourceRepo gitrepo.Repository , library * config.LibraryState , commits []* gitrepo.Commit , filesFilter func (files []string ) bool ) ([]* conventionalcommits .ConventionalCommit , error ) {
156- var conventionalCommits []* conventionalcommits .ConventionalCommit
154+ func convertToConventionalCommits (sourceRepo gitrepo.Repository , library * config.LibraryState , commits []* gitrepo.Commit , filesFilter func (files []string ) bool ) ([]* gitrepo .ConventionalCommit , error ) {
155+ var conventionalCommits []* gitrepo .ConventionalCommit
157156 for _ , commit := range commits {
158157 files , err := sourceRepo .ChangedFilesInCommit (commit .Hash .String ())
159158 if err != nil {
@@ -162,7 +161,7 @@ func convertToConventionalCommits(sourceRepo gitrepo.Repository, library *config
162161 if ! filesFilter (files ) {
163162 continue
164163 }
165- parsedCommits , err := conventionalcommits .ParseCommits (commit , library .ID )
164+ parsedCommits , err := gitrepo .ParseCommits (commit , library .ID )
166165 if err != nil {
167166 return nil , fmt .Errorf ("failed to parse commit %s: %w" , commit .Hash .String (), err )
168167 }
@@ -195,13 +194,13 @@ func isUnderAnyPath(file string, paths []string) bool {
195194}
196195
197196// NextVersion calculates the next semantic version based on a slice of conventional commits.
198- func NextVersion (commits []* conventionalcommits .ConventionalCommit , currentVersion string ) (string , error ) {
197+ func NextVersion (commits []* gitrepo .ConventionalCommit , currentVersion string ) (string , error ) {
199198 highestChange := getHighestChange (commits )
200199 return semver .DeriveNext (highestChange , currentVersion )
201200}
202201
203202// getHighestChange determines the highest-ranking change type from a slice of commits.
204- func getHighestChange (commits []* conventionalcommits .ConventionalCommit ) semver.ChangeLevel {
203+ func getHighestChange (commits []* gitrepo .ConventionalCommit ) semver.ChangeLevel {
205204 highestChange := semver .None
206205 for _ , commit := range commits {
207206 var currentChange semver.ChangeLevel
0 commit comments