Skip to content

Commit 2287173

Browse files
committed
code cleanup
1 parent 72aeb8c commit 2287173

File tree

2 files changed

+23
-419
lines changed

2 files changed

+23
-419
lines changed

pum/changelog.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,21 @@ def list_changelogs(
9494

9595
changelogs.sort(key=lambda c: c.version)
9696
return changelogs
97+
98+
99+
def changelog_files(changelog: str) -> list[Path]:
100+
"""
101+
Get the ordered list of SQL files in the changelog directory.
102+
This is not recursive, it only returns the files in the given changelog directory.
103+
Args:
104+
changelog (str): The changelog directory.
105+
Returns:
106+
list[Path]: A list of paths to the changelog files.
107+
"""
108+
files = [
109+
changelog.dir / f
110+
for f in listdir(changelog.dir)
111+
if (changelog.dir / f).is_file() and f.endswith(".sql")
112+
]
113+
files.sort()
114+
return files

0 commit comments

Comments
 (0)