rlsbl v0.43.1 /rlsbl.git_util
On this page

Shared git path-filtering utilities: get_commit_files, file_matches_project with path prefix and watch globs, and filter_commits_for_project.

#rlsbl.git_util

#rlsbl.git_util

Shared path-filtering utilities for matching commits to projects.

Provides functions to retrieve files changed by a commit, check whether a file belongs to a project (by path prefix or watch globs), and filter a set of commits to those touching a specific project's files.

#get_commit_files

python
def get_commit_files(sha)

Get the list of files changed by a single commit.

Returns a list of file paths relative to the repo root, or None on error.

#file_matches_project

python
def file_matches_project(filepath, project)

Check whether a file path belongs to a project.

A file belongs to a project if:

  • It starts with the project's path prefix, OR
  • It matches any of the project's watch globs

#filter_commits_for_project

python
def filter_commits_for_project(commits, project)

Filter commits to only those that touch files belonging to a project.

Takes a set of commit SHAs and a project dict. For each commit, gets its changed files and checks whether any file matches the project (by path prefix or watch globs).

Returns the subset of commits where at least one file belongs to the project.