Release 0.3.9: export_docs clean + wiki index pages

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
mihailkudravcev
2026-07-29 13:10:46 +03:00
parent 7dd699dab5
commit 3d272b46c7
7 changed files with 1095 additions and 20 deletions
+35 -18
View File
@@ -79,25 +79,42 @@ def prepare_wiki_clone(
"""Clone or reset wiki working tree."""
work_dir = work_dir.resolve()
if work_dir.exists() and (work_dir / ".git").exists():
_run(["git", "fetch", "origin"], cwd=work_dir)
_run(["git", "checkout", branch], cwd=work_dir)
_run(["git", "reset", "--hard", f"origin/{branch}"], cwd=work_dir)
else:
if work_dir.exists():
def _norm_git_url(u: str) -> str:
return u.strip().rstrip("/")
expected = _norm_git_url(wiki_url)
try:
actual = _run(
["git", "remote", "get-url", "origin"],
cwd=work_dir,
).strip()
except WikiPushError:
actual = ""
if _norm_git_url(actual) != expected:
# Existing clone points to another wiki repo; don't reuse it.
shutil.rmtree(work_dir)
ensure_dir(work_dir.parent)
_run(
[
"git",
"clone",
"--branch",
branch,
"--single-branch",
wiki_url,
str(work_dir),
],
cwd=work_dir.parent,
)
else:
_run(["git", "fetch", "origin"], cwd=work_dir)
_run(["git", "checkout", branch], cwd=work_dir)
_run(["git", "reset", "--hard", f"origin/{branch}"], cwd=work_dir)
return work_dir
if work_dir.exists():
shutil.rmtree(work_dir)
ensure_dir(work_dir.parent)
_run(
[
"git",
"clone",
"--branch",
branch,
"--single-branch",
wiki_url,
str(work_dir),
],
cwd=work_dir.parent,
)
return work_dir