-
-
Notifications
You must be signed in to change notification settings - Fork 289
refactor(changelog): simplify logic for get_oldest_and_newest_rev #1539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v4-9-0-test
Are you sure you want to change the base?
refactor(changelog): simplify logic for get_oldest_and_newest_rev #1539
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## v4-9-0-test #1539 +/- ##
==============================================
Coverage ? 97.92%
==============================================
Files ? 58
Lines ? 2694
Branches ? 0
==============================================
Hits ? 2638
Misses ? 56
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
raise NoCommitsFoundError(f"Could not find a valid revision range. {version=}") | ||
|
||
|
||
# TODO: unused, deprecate this? | ||
def get_smart_tag_range( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if removing the function is a breaking change.
0b7774c
to
7316c2f
Compare
def get_next_tag_name_after_version(tags: Iterable[GitTag], version: str) -> str | None: | ||
a, b = tee(chain((tag.name for tag in tags), [None])) | ||
next(b, None) | ||
try: | ||
return next(y for x, y in zip(a, b) if x == version) | ||
except StopIteration: | ||
raise NoCommitsFoundError(f"Could not find a valid revision range. {version=}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @gbaian10 for reminding me here we don't have to use a while loop.
…rk unused for get_smart_tag_range
7316c2f
to
1d9f4ab
Compare
Description
get_oldest_and_newest_rev
get_smart_range
, I believe we can replace it with a simpler function.get_next_tag_name_after_version
is based on an assumption that "all GitTags are unique". If the oldest tag's name is the inputversion
, then it returnsNone
. The behavior aligns with "ReturnNone
foroldest_rev
if the oldest tag is the last tag in the list and matches the requested oldest tag"Checklist
Code Changes
poetry all
locally to ensure this change passes linter check and tests