From 67d31513c850cd21af21c7d8eba9708d695b60cf Mon Sep 17 00:00:00 2001 From: luojian Date: Thu, 16 Oct 2025 18:03:01 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"Satiszen=EF=BC=9A=20Tidy=20ASMR=20Lau?= =?UTF-8?q?ncher=20fix=20bug"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 84f2cff0a94c99529c5601149b4676869519e0e4. --- scripts/build.py | 4 ++-- scripts/project_init.py | 49 +++++++++++++++++++---------------------- 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/scripts/build.py b/scripts/build.py index 9093f54..12b6a0f 100644 --- a/scripts/build.py +++ b/scripts/build.py @@ -23,8 +23,8 @@ def run(context: Context): ProjectInterface(context), ProjectProguard(context), ProjectBuild(context), - # ProjectUpload(context), - # ProjectEnd(context), + ProjectUpload(context), + ProjectEnd(context), ] for task in tasks: diff --git a/scripts/project_init.py b/scripts/project_init.py index bf76aaf..27bafb3 100644 --- a/scripts/project_init.py +++ b/scripts/project_init.py @@ -12,8 +12,6 @@ def progress(op_code, cur_count, max_count=None, message=''): class ProjectInit(Task): def execute(self): - print("111") - self.context.project_original_path = "/Users/luojian/Documents/project/zicp/Android/GameLauncher" try: repo = Repo(self.context.project_original_path) except Exception: @@ -21,7 +19,6 @@ class ProjectInit(Task): recursive=True, progress=progress) - print("112") # for submodule in repo.submodules: # print(f"子模块 '{submodule.name}' 路径: {submodule.path}") # # print(f"Commit ID: {submodule.module().head.commit}") @@ -34,37 +31,37 @@ class ProjectInit(Task): remote_name = "origin" # 远程仓库默认名称 - # repo.git.fetch(remote_name) + repo.git.fetch(remote_name) - # if repo.active_branch.name != branch_name: - # # 检查本地是否已存在该分支 - # if branch_name in repo.heads: - # # 本地分支已存在,直接切换 - # repo.heads[branch_name].checkout() - # else: - # # 2. 创建本地分支并跟踪远程分支 - # remote_branch_ref = f"{remote_name}/{branch_name}" - # local_branch = repo.create_head(branch_name, remote_branch_ref) # 创建本地分支指向远程 - # local_branch.set_tracking_branch(repo.remotes[remote_name].refs[branch_name]) # 设置跟踪 - # local_branch.checkout() # 切换到该分支 + if repo.active_branch.name != branch_name: + # 检查本地是否已存在该分支 + if branch_name in repo.heads: + # 本地分支已存在,直接切换 + repo.heads[branch_name].checkout() + else: + # 2. 创建本地分支并跟踪远程分支 + remote_branch_ref = f"{remote_name}/{branch_name}" + local_branch = repo.create_head(branch_name, remote_branch_ref) # 创建本地分支指向远程 + local_branch.set_tracking_branch(repo.remotes[remote_name].refs[branch_name]) # 设置跟踪 + local_branch.checkout() # 切换到该分支 self.context.local_repo_branch = repo.active_branch.name self.context.local_repo_commit = repo.head.commit.hexsha[:10] # 拉取最新代码 - # repo.remotes.origin.pull() + repo.remotes.origin.pull() print("当前分支:" + repo.active_branch.name) pass else: raise Exception(f"No commit to {self.context.repo_commit}") - # repo.git.submodule('update', '--init', '--recursive') - # - # for submodule in repo.submodules: - # print(submodule.url) - # print(submodule.name) - # print(submodule.hexsha) - # print(submodule.path) - # sub_repo = submodule.module() - # sub_repo.git.reset("--hard", submodule.hexsha) - # print(f"Reset {submodule.name} to {submodule.hexsha[:7]}") + repo.git.submodule('update', '--init', '--recursive') + + for submodule in repo.submodules: + print(submodule.url) + print(submodule.name) + print(submodule.hexsha) + print(submodule.path) + sub_repo = submodule.module() + sub_repo.git.reset("--hard", submodule.hexsha) + print(f"Reset {submodule.name} to {submodule.hexsha[:7]}")