diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2025-05-12 15:29:02 +0200 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2025-05-13 10:05:33 +0000 |
| commit | 09706c899ce54513472d621bf9d84c0e8e5eaea8 (patch) | |
| tree | 765c3be157c9ef150ab685d545b8c36795c791e6 /pkg/email/lore | |
| parent | 50f6de2f6c8b05193d0ca3f3881bd662b4babe60 (diff) | |
pkg/vcs: extend ListCommitHashes
Rename the method to LatestCommit and make it more flexible:
1) Return the commit date alongside the commit hash.
2) Rename the time filter to highlight that it's non-inclusive.
3) Make it possible to query the commits newer than the specified commit
hash.
It will let us poll lore archives more efficiently.
Diffstat (limited to 'pkg/email/lore')
| -rw-r--r-- | pkg/email/lore/read.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pkg/email/lore/read.go b/pkg/email/lore/read.go index ef0a0faa0..d4e68cf33 100644 --- a/pkg/email/lore/read.go +++ b/pkg/email/lore/read.go @@ -13,12 +13,13 @@ import ( ) type EmailReader struct { + vcs.CommitShort Read func() ([]byte, error) } // ReadArchive queries the parsed messages from a single LKML message archive. -func ReadArchive(repo vcs.Repo, fromTime time.Time) ([]EmailReader, error) { - commits, err := repo.ListCommitHashes("HEAD", fromTime) +func ReadArchive(repo vcs.Repo, afterCommit string, afterTime time.Time) ([]EmailReader, error) { + commits, err := repo.LatestCommits(afterCommit, afterTime) if err != nil { return nil, fmt.Errorf("failed to get recent commits: %w", err) } @@ -26,8 +27,9 @@ func ReadArchive(repo vcs.Repo, fromTime time.Time) ([]EmailReader, error) { for _, iterCommit := range commits { commit := iterCommit ret = append(ret, EmailReader{ + CommitShort: commit, Read: func() ([]byte, error) { - return repo.Object("m", commit) + return repo.Object("m", commit.Hash) }, }) } |
