|
1 | 1 | """git information access.""" |
2 | 2 |
|
3 | | -from typing import Optional |
| 3 | +from typing import List, Optional |
4 | 4 |
|
5 | 5 | import datetime |
6 | 6 | import os |
@@ -85,8 +85,16 @@ def parse_commits(repository: Repo, starting_rev: Optional[str] = None, ending_r |
85 | 85 | return [repository.commit(commit) for commit in commits if commit] |
86 | 86 |
|
87 | 87 |
|
88 | | -def get_tags(repository: Repo) -> list: |
89 | | - """Get all the tags in a repository.""" |
| 88 | +def get_tags(repository: Repo) -> List[TagInfo]: |
| 89 | + """ |
| 90 | + Get all the tags in a repository. |
| 91 | +
|
| 92 | + Args: |
| 93 | + repository: The repository object containing the tags |
| 94 | +
|
| 95 | + Returns: |
| 96 | + A list of TagInfo objects with the most recent first |
| 97 | + """ |
90 | 98 | tags = repository.tags |
91 | 99 | tags_list = [] |
92 | 100 |
|
@@ -114,8 +122,18 @@ def get_tags(repository: Repo) -> list: |
114 | 122 | return tags_list |
115 | 123 |
|
116 | 124 |
|
117 | | -def get_commits_by_tags(repository: Repo, tag_filter_pattern: str, starting_tag: Optional[str] = None) -> list: |
118 | | - """Group commits by the tags they belong to.""" |
| 125 | +def get_commits_by_tags(repository: Repo, tag_filter_pattern: str, starting_tag: Optional[str] = None) -> List[dict]: |
| 126 | + """ |
| 127 | + Group commits by the tags they belong to. |
| 128 | +
|
| 129 | + Args: |
| 130 | + repository: The git repository object |
| 131 | + tag_filter_pattern: A regular expression pattern that matches valid tags as versions |
| 132 | + starting_tag: Only include tags after this one |
| 133 | +
|
| 134 | + Returns: |
| 135 | + A list of dictionaries with tag information with most recent first |
| 136 | + """ |
119 | 137 | from generate_changelog.utilities import pairs |
120 | 138 |
|
121 | 139 | tags = [tag for tag in get_tags(repository) if re.match(tag_filter_pattern, tag.name)] |
|
0 commit comments