Skip to content
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

Fix parsing of git urls with egg before subdirectory #518

Merged
merged 2 commits into from
Jan 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions src/poetry/core/vcs/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
rf"(?P<pathname>[:/\\]({PATH}[/\\])?"
rf"((?P<name>{NAME}?)(\.git|[/\\])?)?)"
r"(?:"
r"#egg=?.+"
r"|"
rf"#(?:egg=.+?&subdirectory=|subdirectory=)(?P<subdirectory>{SUBDIR})"
r"|"
rf"[@#](?P<rev>{REV})(?:[&#](?:egg=.+?|(?:egg=.+?&subdirectory=|subdirectory=)(?P<rev_subdirectory>{SUBDIR})))?"
r"#egg=?.+"
r"|"
rf"[@#](?P<rev>{REV})(?:[&#](?:(?:egg=.+?&subdirectory=|subdirectory=)(?P<rev_subdirectory>{SUBDIR})|egg=.+?))?"
r")?"
r"$"
),
Expand All @@ -46,11 +46,11 @@
rf"(?P<pathname>({PATH})"
rf"(?P<name>{NAME})(\.git|/)?)"
r"(?:"
r"#egg=?.+"
r"|"
rf"#(?:egg=.+?&subdirectory=|subdirectory=)(?P<subdirectory>{SUBDIR})"
r"|"
rf"[@#](?P<rev>{REV})(?:[&#](?:egg=.+?|(?:egg=.+?&subdirectory=|subdirectory=)(?P<rev_subdirectory>{SUBDIR})))?"
r"#egg=?.+"
r"|"
rf"[@#](?P<rev>{REV})(?:[&#](?:(?:egg=.+?&subdirectory=|subdirectory=)(?P<rev_subdirectory>{SUBDIR})|egg=.+?))?"
r")?"
r"$"
),
Expand All @@ -61,11 +61,11 @@
rf"(?P<pathname>([:/]{PATH}/)"
rf"(?P<name>{NAME})(\.git|/)?)"
r"(?:"
r"#egg=.+?"
r"|"
rf"#(?:egg=.+?&subdirectory=|subdirectory=)(?P<subdirectory>{SUBDIR})"
r"|"
rf"[@#](?P<rev>{REV})(?:[&#](?:egg=.+?&subdirectory=|subdirectory=)(?P<rev_subdirectory>{SUBDIR}))?"
r"#egg=?.+"
r"|"
rf"[@#](?P<rev>{REV})(?:[&#](?:(?:egg=.+?&subdirectory=|subdirectory=)(?P<rev_subdirectory>{SUBDIR})|egg=.+?))?"
r")?"
r"$"
),
Expand All @@ -76,11 +76,11 @@
rf"(?P<pathname>({PATH})"
rf"(?P<name>{NAME})(\.git|/)?)"
r"(?:"
r"#egg=?.+"
r"|"
rf"#(?:egg=.+?&subdirectory=|subdirectory=)(?P<subdirectory>{SUBDIR})"
r"|"
rf"[@#](?P<rev>{REV})(?:[&#](?:egg=.+?|(?:egg=.+?&subdirectory=|subdirectory=)(?P<rev_subdirectory>{SUBDIR})))?"
r"#egg=?.+"
r"|"
rf"[@#](?P<rev>{REV})(?:[&#](?:(?:egg=.+?&subdirectory=|subdirectory=)(?P<rev_subdirectory>{SUBDIR})|egg=.+?))?"
r")?"
r"$"
),
Expand Down
1 change: 1 addition & 0 deletions tests/vcs/test_vcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ def test_parse_url(url: str, parsed: ParsedUrl) -> None:
assert result.rev == parsed.rev
assert result.url == parsed.url
assert result.user == parsed.user
assert result.subdirectory == parsed.subdirectory


def test_parse_url_should_fail() -> None:
Expand Down