repo_splitter.git_tools.files package

Submodules

repo_splitter.git_tools.files.all module

repo_splitter.git_tools.files.all.get_all_repo_files(repo, current_files_only=False)[source]

Get all the file paths from a repo

Parameters
  • repo (Repo) – git Repo

  • current_files_only (bool) – if False, will search the entire git history for file names, defaults to False

Return type

List[str]

Returns

File paths

repo_splitter.git_tools.files.renames module

exception repo_splitter.git_tools.files.renames.EmptyFileException[source]

Bases: Exception

repo_splitter.git_tools.files.renames.all_file_names_which_have_contained_the_lines_in_a_file(file_path, repo)[source]

Parses the git log for all lines in a file, to determine all the file paths in which these lines have existed.

Useful for tracking renames in a repo.

Parameters
  • file_path (str) – Relative path to file within repo

  • repo (Repo) –

Return type

Set[str]

Returns

repo_splitter.git_tools.files.renames.all_file_names_which_have_contained_the_lines_in_multiple_files(file_paths, repo)[source]

Parses the git log for all lines in multiple files, to determine all the file paths in which these lines have existed.

Useful for tracking renames in a repo.

Parameters
  • file_paths (Sequence[str]) – Relative paths to file within repo

  • repo (Repo) –

Return type

Set[str]

Returns

repo_splitter.git_tools.files.renames.file_length(file_path)[source]

Returns the number of lines in a file

Return type

int

repo_splitter.git_tools.files.renames.full_git_history_for_contents_of_file(file_path, repo)[source]

Runs git log on all of the lines in a file

Return type

str

repo_splitter.git_tools.files.renames.get_filenames_from_git_log(git_log)[source]
Parameters

git_log (str) –

Return type

Set[str]

Returns

repo_splitter.git_tools.files.unwanted module

repo_splitter.git_tools.files.unwanted.get_unwanted_files_from_repo(repo, file_patterns, follow_renames=True)[source]

repo_splitter.git_tools.files.wanted module

repo_splitter.git_tools.files.wanted.get_desired_files_from_patterns(repo, file_patterns, follow_renames=True)[source]

Pass glob file patterns relative to repo root such as data/** or code/* or code/my_module.py

Handles resolving within the repo, and expanding globs into full relative file paths

Parameters
  • repo (Repo) –

  • file_patterns (Sequence[str]) – A sequence of glob file patterns relative to repo root such as

data/** or code/* or code/my_module.py :type _sphinx_paramlinks_repo_splitter.git_tools.files.wanted.get_desired_files_from_patterns.follow_renames: bool :param _sphinx_paramlinks_repo_splitter.git_tools.files.wanted.get_desired_files_from_patterns.follow_renames: Whether to track previous names of files from the history and also include those :rtype: List[str] :return:

Module contents