Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/codegen/git/repo_operator/repo_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@ def iter_files(
subdirs: list[str] | None = None,
extensions: list[str] | None = None,
ignore_list: list[str] | None = None,
skip_content: bool = False,
) -> Generator[tuple[str, str]]:
"""Iterates over all files in the codebase, yielding the filepath and its content.

Expand All @@ -642,8 +643,11 @@ def iter_files(

if extensions is None or any(filepath.endswith(e) for e in extensions):
try:
content = self.get_file(filepath)
yield rel_filepath, content
if not skip_content:
content = self.get_file(filepath)
yield rel_filepath, content
else:
yield rel_filepath, ""
except Exception as e:
logger.warning(f"Error reading file {filepath}: {e}")

Expand Down
7 changes: 5 additions & 2 deletions src/codegen/sdk/codebase/codebase_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,11 @@ def build_directory_tree(self) -> None:
# Reset and rebuild the directory tree
self.directories = dict()

for file_path, _ in self.projects[0].repo_operator.iter_files(subdirs=self.projects[0].subdirectories, ignore_list=GLOBAL_FILE_IGNORE_LIST):
for file_path, _ in self.projects[0].repo_operator.iter_files(
subdirs=self.projects[0].subdirectories,
ignore_list=GLOBAL_FILE_IGNORE_LIST,
skip_content=True,
):
file_path = Path(file_path)
directory = self.get_directory(file_path.parent, create_on_missing=True)
directory._add_file(file_path.name)
Expand Down Expand Up @@ -510,7 +514,6 @@ def _process_diff_files(self, files_to_sync: Mapping[SyncType, list[Path]], incr

# Step 6: Build directory tree
logger.info("> Building directory tree")
files = [f for f in sort_editables(self.get_nodes(NodeType.FILE), alphabetical=True, dedupe=False)]
self.build_directory_tree()

# Step 7: Build configs
Expand Down
Loading