File tree Expand file tree Collapse file tree 4 files changed +19
-18
lines changed Expand file tree Collapse file tree 4 files changed +19
-18
lines changed Original file line number Diff line number Diff line change 44 ((?P<user>[^/:@]+)@)?
55"""
66"""Optional user, e.g. 'git@'"""
7+
8+ # Credit, pip (license: MIT):
9+ # https://github.com/pypa/pip/blob/22.1.2/src/pip/_internal/vcs/git.py#L39-L52
10+ # We modified it to have groupings
11+ SCP_REGEX = r"""
12+ # Server, e.g. 'github.com'.
13+ (?P<hostname>([^/:]+))
14+ (?P<separator>:)
15+ # The server-side path. e.g. 'user/project.git'. Must start with an
16+ # alphanumeric character so as not to be confusable with a Windows paths
17+ # like 'C:/foo/bar' or 'C:\foo\bar'.
18+ (?P<path>(\w[^:.]+))
19+ """
20+ """Regular expression for scp-style of git URLs."""
Original file line number Diff line number Diff line change 2323from libvcs ._internal .dataclasses import SkipDefaultFieldsReprMixin
2424
2525from .base import Rule , RuleMap , URLProtocol
26- from .constants import RE_USER
27-
28- # Credit, pip (license: MIT):
29- # https://github.com/pypa/pip/blob/22.1.2/src/pip/_internal/vcs/git.py#L39-L52
30- # We modified it to have groupings
31- SCP_REGEX = r"""
32- # Server, e.g. 'github.com'.
33- (?P<hostname>([^/:]+))
34- (?P<separator>:)
35- # The server-side path. e.g. 'user/project.git'. Must start with an
36- # alphanumeric character so as not to be confusable with a Windows paths
37- # like 'C:/foo/bar' or 'C:\foo\bar'.
38- (?P<path>(\w[^:.]+))
39- """
26+ from .constants import RE_USER , SCP_REGEX
4027
4128RE_PATH = r"""
4229 (?P<hostname>([^/:]+))
Original file line number Diff line number Diff line change 2222from typing import Optional
2323
2424from libvcs ._internal .dataclasses import SkipDefaultFieldsReprMixin
25- from libvcs .url .git import RE_PIP_REV , RE_SUFFIX , SCP_REGEX
25+ from libvcs .url .git import RE_PIP_REV , RE_SUFFIX
2626
2727from .base import Rule , RuleMap , URLProtocol
28- from .constants import RE_USER
28+ from .constants import RE_USER , SCP_REGEX
2929
3030RE_PATH = r"""
3131 (?P<hostname>([^/:]+))
Original file line number Diff line number Diff line change 2323from typing import Optional
2424
2525from libvcs ._internal .dataclasses import SkipDefaultFieldsReprMixin
26- from libvcs .url .git import RE_PIP_REV , SCP_REGEX
26+ from libvcs .url .git import RE_PIP_REV
2727
2828from .base import Rule , RuleMap , URLProtocol
29- from .constants import RE_USER
29+ from .constants import RE_USER , SCP_REGEX
3030
3131RE_PATH = r"""
3232 (?P<hostname>([^/:@]+))
You can’t perform that action at this time.
0 commit comments