From eec28bf8b5cc8148715a46c34954c5d39b89e008 Mon Sep 17 00:00:00 2001 From: ngfchl Date: Fri, 7 Oct 2022 21:20:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8C=89=E5=88=86=E6=94=AF?= =?UTF-8?q?=EF=BC=88=E7=A8=B3=E5=AE=9A=E3=80=81=E5=BC=80=E5=8F=91=EF=BC=89?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=9B=B4=E6=96=B0=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- auto_pt/views.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/auto_pt/views.py b/auto_pt/views.py index 8e924f1..37e2ae0 100644 --- a/auto_pt/views.py +++ b/auto_pt/views.py @@ -1,5 +1,6 @@ import json import logging +import os import socket import subprocess import time @@ -303,9 +304,18 @@ def get_update_logs(): # 拉取仓库更新记录元数据 repo.remote().update() # 获取本地仓库commits更新记录 - commits = list(repo.iter_commits('master', max_count=10)) + branch = 'master' + if os.getenv('DEV'): + branch = os.getenv('DEV') + logger.info('当前分支') + logger.info(branch) + commits = list(repo.iter_commits(branch, max_count=10)) + logger.info('本地记录') + logger.info(commits) # 获取远程仓库commits记录 - remote_commits = list(repo.iter_commits("origin/master", max_count=10)) + remote_commits = list(repo.iter_commits("origin/" + branch, max_count=10)) + logger.info('远程仓库更新记录') + logger.info(remote_commits) return commits[0].hexsha == remote_commits[0].hexsha