feat: thread SVN auth (username/password) through all svn call sites
This commit is contained in:
@@ -91,8 +91,11 @@ def _wc_path(mirror: Mirror, svn_branch: str) -> Path:
|
||||
|
||||
|
||||
def _run_svn(args: list, input: bytes = None, timeout: int = 120,
|
||||
wc: Optional[Path] = None):
|
||||
wc: Optional[Path] = None,
|
||||
auth_args: Optional[list] = None):
|
||||
"""Run an svn command. If *wc* is given, run from that directory."""
|
||||
if auth_args:
|
||||
args = auth_args + args
|
||||
env = {**os.environ, "LC_ALL": "C"}
|
||||
try:
|
||||
r = subprocess.run(
|
||||
@@ -116,12 +119,14 @@ def _run_svn(args: list, input: bytes = None, timeout: int = 120,
|
||||
|
||||
def _ensure_wc(mirror: Mirror, svn_branch: str):
|
||||
"""Ensure the SVN working copy for *svn_branch* exists and is at HEAD."""
|
||||
auth_args = mirror.config.svn.auth_args()
|
||||
wc = _wc_path(mirror, svn_branch)
|
||||
svn_url = mirror.config.svn.url.rstrip("/") + "/" + svn_branch
|
||||
if not (wc / ".svn").exists():
|
||||
logger.info("Checking out SVN WC for %s …", svn_branch)
|
||||
wc.mkdir(parents=True, exist_ok=True)
|
||||
_run_svn(["checkout", svn_url, str(wc)], timeout=300)
|
||||
_run_svn(["checkout", svn_url, str(wc)], timeout=300,
|
||||
auth_args=auth_args)
|
||||
else:
|
||||
logger.debug("Updating SVN WC for %s …", svn_branch)
|
||||
_run_svn(["revert", "-R", "."], timeout=120, wc=wc)
|
||||
|
||||
Reference in New Issue
Block a user