0
# VCS Integration
1
2
Version control system integration for managing news fragments and staging files.
3
4
## Capabilities
5
6
### Fragment Management
7
8
Remove news fragment files from the repository after building the changelog.
9
10
```python { .api }
11
def remove_files(base_directory: str, fragment_filenames: list[str]) -> None:
12
"""
13
Remove fragment files from the VCS.
14
15
Args:
16
base_directory: Base directory of the repository
17
fragment_filenames: List of fragment filenames to remove
18
"""
19
```
20
21
### News File Staging
22
23
Stage the generated news file in version control.
24
25
```python { .api }
26
def stage_newsfile(directory: str, filename: str) -> None:
27
"""
28
Stage the news file in version control.
29
30
Args:
31
directory: Directory containing the news file
32
filename: Name of the news file to stage
33
"""
34
```
35
36
### Branch Operations
37
38
Get information about remote branches and determine default comparison targets.
39
40
```python { .api }
41
def get_remote_branches(base_directory: str) -> list[str]:
42
"""
43
Get list of remote branches.
44
45
Args:
46
base_directory: Base directory of the repository
47
48
Returns:
49
List of remote branch names
50
"""
51
52
def get_default_compare_branch(
53
base_directory: str,
54
branches: Container[str]
55
) -> str | None:
56
"""
57
Determine the default branch to compare against.
58
59
Args:
60
base_directory: Base directory of the repository
61
branches: Available branch names
62
63
Returns:
64
Default branch name or None if unable to determine
65
"""
66
67
def list_changed_files_compared_to_branch(
68
base_directory: str,
69
compare_with: str,
70
include_staged: bool
71
) -> list[str]:
72
"""
73
List files changed compared to a branch.
74
75
Args:
76
base_directory: Base directory of the repository
77
compare_with: Branch name to compare against
78
include_staged: Whether to include staged files
79
80
Returns:
81
List of changed file paths
82
"""
83
```
84
85
## Imports
86
87
```python
88
from towncrier._vcs import (
89
remove_files,
90
stage_newsfile,
91
get_remote_branches,
92
get_default_compare_branch,
93
list_changed_files_compared_to_branch
94
)
95
```