repo2xml.bundler.bundle_repo¶
- bundle_repo(repo_path: str | Path = '.', *, output_path: str | Path | None = None, respect_gitignore: bool = True, max_file_size: int = 1048576, extra_ignore_patterns: list[str] | None = None, include_patterns: list[str] | None = None) str[source]¶
Bundle a repository into a single XML string.
Convenience wrapper around
RepoBundler.- Parameters:
repo_path – Path to the repository directory (default: current directory).
output_path – If given, also write the XML to this file.
respect_gitignore – Whether to respect
.gitignorerules.max_file_size – Maximum file size in bytes to include.
extra_ignore_patterns – Additional gitignore-style patterns to exclude.
include_patterns – Patterns that override default and extra excludes.
- Returns:
The XML representation of the repository as a string.
>>> import tempfile, pathlib >>> with tempfile.TemporaryDirectory() as d: ... p = pathlib.Path(d) ... _ = (p / "hello.py").write_text("x = 1\n") ... xml = bundle_repo(p) ... "hello.py" in xml True