|
11 | 11 |
|
12 | 12 | - [`SvnSync.get_url`](libvcs.svn.SvnSync.get_url) |
13 | 13 | - [`SvnSync.get_revision`](libvcs.svn.SvnSync.get_revision) |
14 | | - - [`get_rev_options`](libvcs.svn.get_rev_options) |
15 | 14 | """ # NOQA: E5 |
16 | 15 | import logging |
17 | 16 | import os |
18 | 17 | import pathlib |
19 | 18 | import re |
20 | 19 | from typing import Any, Optional |
21 | | -from urllib import parse as urlparse |
22 | 20 |
|
23 | 21 | from libvcs._internal.run import run |
24 | 22 | from libvcs._internal.types import StrPath |
@@ -203,32 +201,3 @@ def _get_svn_url_rev(cls, location: str) -> tuple[Optional[str], int]: |
203 | 201 | @property |
204 | 202 | def cmd(self, *args: object, **kwargs: object) -> Svn: |
205 | 203 | return Svn(dir=self.dir, *args, **kwargs) |
206 | | - |
207 | | - |
208 | | -def get_rev_options(url: str, rev: None) -> list[Any]: |
209 | | - """Return revision options. From pip pip.vcs.subversion.""" |
210 | | - if rev: |
211 | | - rev_options = ["-r", rev] |
212 | | - else: |
213 | | - rev_options = [] |
214 | | - |
215 | | - r = urlparse.urlsplit(url) |
216 | | - if hasattr(r, "username"): |
217 | | - # >= Python-2.5 |
218 | | - username, password = r.username, r.password |
219 | | - else: |
220 | | - netloc = r[1] |
221 | | - if "@" in netloc: |
222 | | - auth = netloc.split("@")[0] |
223 | | - if ":" in auth: |
224 | | - username, password = auth.split(":", 1) |
225 | | - else: |
226 | | - username, password = auth, None |
227 | | - else: |
228 | | - username, password = None, None |
229 | | - |
230 | | - if username: |
231 | | - rev_options += ["--username", username] |
232 | | - if password: |
233 | | - rev_options += ["--password", password] |
234 | | - return rev_options |
0 commit comments