fix: colab notebook — idempotent clone (pull if repo exists)
Cell 1 now detects an existing /content/luke_scribe/.git and runs git fetch + checkout feat/full-platform + pull --ff-only instead of rm -rf + clone, so re-running the notebook updates instead of wiping local changes.
This commit is contained in:
@@ -40,7 +40,7 @@
|
|||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": "# 1) 클론 (private 저장소면 GITEA_TOKEN 입력)\nGITEA_TOKEN = '' # ← 필요 시 입력: https://git.lukehemmin.com/user/settings/applications\n\nif GITEA_TOKEN:\n REPO = f'https://{GITEA_TOKEN}@git.lukehemmin.com/lukehemmin/luke_scribe.git'\nelse:\n REPO = 'https://git.lukehemmin.com/lukehemmin/luke_scribe.git'\n\n!rm -rf luke_scribe\n!git clone -b feat/full-platform {REPO}\nimport os\nos.chdir('/content/luke_scribe')\nprint('클론 완료 →', os.getcwd())\n!git log --oneline -1\n"
|
"source": "# 1) 클론 또는 업데이트 (private 저장소면 GITEA_TOKEN 입력)\nGITEA_TOKEN = '' # ← 필요 시 입력: https://git.lukehemmin.com/user/settings/applications\n\nif GITEA_TOKEN:\n REPO = f'https://{GITEA_TOKEN}@git.lukehemmin.com/lukehemmin/luke_scribe.git'\nelse:\n REPO = 'https://git.lukehemmin.com/lukehemmin/luke_scribe.git'\n\nimport os, subprocess\n\nif os.path.isdir('/content/luke_scribe/.git'):\n # 이미 클론된 레포 → 최신 브랜치로 갱신 (pull)\n print('기존 레포 감지 → pull로 갱신')\n subprocess.run(['git', 'fetch', 'origin'], cwd='/content/luke_scribe', check=True)\n subprocess.run(['git', 'checkout', 'feat/full-platform'], cwd='/content/luke_scribe', check=True)\n subprocess.run(['git', 'pull', '--ff-only', 'origin', 'feat/full-platform'], cwd='/content/luke_scribe', check=True)\nelse:\n # 최초 실행 → 클론\n subprocess.run(['git', 'clone', '-b', 'feat/full-platform', REPO], cwd='/content', check=True)\n\nos.chdir('/content/luke_scribe')\nprint('작업 디렉터리 →', os.getcwd())\n!git log --oneline -1\n"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ def cells() -> list[dict]:
|
|||||||
"저장소가 private이면 아래 셀의 `GITEA_TOKEN`에 토큰을 입력하세요."
|
"저장소가 private이면 아래 셀의 `GITEA_TOKEN`에 토큰을 입력하세요."
|
||||||
),
|
),
|
||||||
code(
|
code(
|
||||||
"# 1) 클론 (private 저장소면 GITEA_TOKEN 입력)\n"
|
"# 1) 클론 또는 업데이트 (private 저장소면 GITEA_TOKEN 입력)\n"
|
||||||
"GITEA_TOKEN = '' # ← 필요 시 입력: https://git.lukehemmin.com/user/settings/applications\n"
|
"GITEA_TOKEN = '' # ← 필요 시 입력: https://git.lukehemmin.com/user/settings/applications\n"
|
||||||
"\n"
|
"\n"
|
||||||
"if GITEA_TOKEN:\n"
|
"if GITEA_TOKEN:\n"
|
||||||
@@ -78,11 +78,20 @@ def cells() -> list[dict]:
|
|||||||
"else:\n"
|
"else:\n"
|
||||||
" REPO = 'https://git.lukehemmin.com/lukehemmin/luke_scribe.git'\n"
|
" REPO = 'https://git.lukehemmin.com/lukehemmin/luke_scribe.git'\n"
|
||||||
"\n"
|
"\n"
|
||||||
"!rm -rf luke_scribe\n"
|
"import os, subprocess\n"
|
||||||
"!git clone -b feat/full-platform {REPO}\n"
|
"\n"
|
||||||
"import os\n"
|
"if os.path.isdir('/content/luke_scribe/.git'):\n"
|
||||||
|
" # 이미 클론된 레포 → 최신 브랜치로 갱신 (pull)\n"
|
||||||
|
" print('기존 레포 감지 → pull로 갱신')\n"
|
||||||
|
" subprocess.run(['git', 'fetch', 'origin'], cwd='/content/luke_scribe', check=True)\n"
|
||||||
|
" subprocess.run(['git', 'checkout', 'feat/full-platform'], cwd='/content/luke_scribe', check=True)\n"
|
||||||
|
" subprocess.run(['git', 'pull', '--ff-only', 'origin', 'feat/full-platform'], cwd='/content/luke_scribe', check=True)\n"
|
||||||
|
"else:\n"
|
||||||
|
" # 최초 실행 → 클론\n"
|
||||||
|
" subprocess.run(['git', 'clone', '-b', 'feat/full-platform', REPO], cwd='/content', check=True)\n"
|
||||||
|
"\n"
|
||||||
"os.chdir('/content/luke_scribe')\n"
|
"os.chdir('/content/luke_scribe')\n"
|
||||||
"print('클론 완료 →', os.getcwd())\n"
|
"print('작업 디렉터리 →', os.getcwd())\n"
|
||||||
"!git log --oneline -1\n"
|
"!git log --oneline -1\n"
|
||||||
),
|
),
|
||||||
md("## 2) 시스템 의존성 + 설치\n\nffmpeg(오디오 정규화) 설치 후 venv에 luke-scribe를 설치합니다."),
|
md("## 2) 시스템 의존성 + 설치\n\nffmpeg(오디오 정규화) 설치 후 venv에 luke-scribe를 설치합니다."),
|
||||||
|
|||||||
Reference in New Issue
Block a user