From e8a55e0e781a0f7f808f5d20dbf6489744a325e7 Mon Sep 17 00:00:00 2001 From: ob-robot Date: Thu, 5 Jan 2023 14:36:37 +0800 Subject: [PATCH] fix repo force push problem --- sync/{rebase_logic_demo.py => merge_logic_demo.py} | 10 +++++----- sync/rebase_logic_gitlink.py | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) rename sync/{rebase_logic_demo.py => merge_logic_demo.py} (94%) diff --git a/sync/rebase_logic_demo.py b/sync/merge_logic_demo.py similarity index 94% rename from sync/rebase_logic_demo.py rename to sync/merge_logic_demo.py index ddbf51b..9cc80e6 100644 --- a/sync/rebase_logic_demo.py +++ b/sync/merge_logic_demo.py @@ -52,23 +52,23 @@ async def sync_inter_code_by_rabase(project: ProjectDTO, job: JobDTO): await cmd.shell('git remote add gitee ' + gitee_address, repo_dir, job) await cmd.shell('git fetch gitee', repo_dir, job) - await cmd.shell('git pull -r gitee ' + job.gitee_branch, repo_dir, job) + await cmd.shell(f"git pull gitee {job.gitee_branch} --no-edit", repo_dir, job) # if gitcode is not null, sync it if project.code_china_address: await cmd.shell('git remote add csdn ' + project.code_china_address, repo_dir, job) await cmd.shell('git fetch csdn', repo_dir, job) - await cmd.shell('git pull -r csdn ' + job.code_china_branch, repo_dir, job) + await cmd.shell(f"git pull csdn {job.code_china_branch} --no-edit", repo_dir, job) await cmd.shell( - f"git push origin {job.github_branch} -f", repo_dir, job) + f"git push origin {job.github_branch}", repo_dir, job) if project.gitee_address: await cmd.shell( - f"git push gitee {job.github_branch}:{job.gitee_branch} -f", repo_dir, job) + f"git push gitee {job.github_branch}:{job.gitee_branch}", repo_dir, job) if project.code_china_address: await cmd.shell( - f"git push csdn {job.github_branch}:{job.code_china_branch} -f", repo_dir, job) + f"git push csdn {job.github_branch}:{job.code_china_branch}", repo_dir, job) # update the latest commit hash # for rebase logic maybe is not useful diff --git a/sync/rebase_logic_gitlink.py b/sync/rebase_logic_gitlink.py index d98810f..3d744ed 100644 --- a/sync/rebase_logic_gitlink.py +++ b/sync/rebase_logic_gitlink.py @@ -55,7 +55,7 @@ async def sync_inter_code_by_rabase(project: ProjectDTO, job: JobDTO): await cmd.shell('git remote add github ' + github_address, repo_dir, job) await cmd.shell('git fetch github', repo_dir, job) - await cmd.shell('git pull -r github ' + job.github_branch, repo_dir, job) + await cmd.shell(f"git pull github {job.github_branch} --no-edit", repo_dir, job) # if gitee is not null, sync it if project.gitee_address and job.gitee_branch: # gitee @@ -63,26 +63,26 @@ async def sync_inter_code_by_rabase(project: ProjectDTO, job: JobDTO): await cmd.shell('git remote add gitee ' + gitee_address, repo_dir, job) await cmd.shell('git fetch gitee', repo_dir, job) - await cmd.shell('git pull -r gitee ' + job.gitee_branch, repo_dir, job) + await cmd.shell(f"git pull gitee {job.gitee_branch} --no-edit", repo_dir, job) # # if gitcode is not null, sync it # if project.code_china_address: # await cmd.shell('git remote add csdn ' + # project.code_china_address, repo_dir, job) # await cmd.shell('git fetch csdn', repo_dir, job) - # await cmd.shell('git pull -r csdn ' + job.code_china_branch, repo_dir, job) + # await cmd.shell(f"git pull csdn {job.code_china_branch} --no-edit", repo_dir, job) await cmd.shell( - f"git push origin {job.gitlink_branch} -f", repo_dir, job) + f"git push origin {job.gitlink_branch}", repo_dir, job) if project.github_address and job.github_branch: await cmd.shell( - f"git push github {job.gitlink_branch}:{job.github_branch} -f", repo_dir, job) + f"git push github {job.gitlink_branch}:{job.github_branch}", repo_dir, job) if project.gitee_address and job.gitee_branch: await cmd.shell( - f"git push gitee {job.gitlink_branch}:{job.gitee_branch} -f", repo_dir, job) + f"git push gitee {job.gitlink_branch}:{job.gitee_branch}", repo_dir, job) if project.code_china_address: await cmd.shell( - f"git push csdn {job.github_branch}:{job.code_china_branch} -f", repo_dir, job) + f"git push csdn {job.github_branch}:{job.code_china_branch}", repo_dir, job) # update the latest commit hash # for rebase logic maybe is not useful