feat: thread SVN auth (username/password) through all svn call sites
This commit is contained in:
+15
-1
@@ -28,6 +28,14 @@ class SVNConfig:
|
||||
trunk: str = "trunk"
|
||||
branches: str = "branches"
|
||||
tags: str = "tags"
|
||||
username: Optional[str] = None
|
||||
password: Optional[str] = None
|
||||
|
||||
def auth_args(self) -> list:
|
||||
"""Return ``['--username', u, '--password', p]`` if configured, else []."""
|
||||
if self.username:
|
||||
return ["--username", self.username, "--password", self.password or ""]
|
||||
return []
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, d: dict, prefix: str) -> "SVNConfig":
|
||||
@@ -47,7 +55,13 @@ class SVNConfig:
|
||||
for name, val in [("trunk", trunk), ("branches", branches), ("tags", tags)]:
|
||||
_check_type(val, str, f"{prefix}.{name}")
|
||||
|
||||
return cls(url=url, layout=layout, trunk=trunk, branches=branches, tags=tags)
|
||||
username = d.get("username")
|
||||
_check_optional(username, str, f"{prefix}.username")
|
||||
password = d.get("password")
|
||||
_check_optional(password, str, f"{prefix}.password")
|
||||
|
||||
return cls(url=url, layout=layout, trunk=trunk, branches=branches,
|
||||
tags=tags, username=username, password=password)
|
||||
|
||||
|
||||
@dataclass
|
||||
|
||||
Reference in New Issue
Block a user