|
|
@ -149,6 +149,7 @@ class GitDbUtil: |
|
|
|
# 从git中获取版本列表后和数据库对比,添加新的版本到数据库 |
|
|
|
# 从git中获取版本列表后和数据库对比,添加新的版本到数据库 |
|
|
|
def set_release_to_db(self): |
|
|
|
def set_release_to_db(self): |
|
|
|
local_repo = Repo(self.local_code_path) |
|
|
|
local_repo = Repo(self.local_code_path) |
|
|
|
|
|
|
|
local_repo.git.execute('git fetch --all') |
|
|
|
release = [] |
|
|
|
release = [] |
|
|
|
for remote in local_repo.remotes: |
|
|
|
for remote in local_repo.remotes: |
|
|
|
for ref in remote.refs: |
|
|
|
for ref in remote.refs: |
|
|
@ -156,9 +157,12 @@ class GitDbUtil: |
|
|
|
saved_release = Release.objects.all() |
|
|
|
saved_release = Release.objects.all() |
|
|
|
saved_release_version_list = [rel.release for rel in saved_release] |
|
|
|
saved_release_version_list = [rel.release for rel in saved_release] |
|
|
|
for rel in release: |
|
|
|
for rel in release: |
|
|
|
|
|
|
|
# print(rel) |
|
|
|
if rel in saved_release_version_list: |
|
|
|
if rel in saved_release_version_list: |
|
|
|
print('pass') |
|
|
|
pass |
|
|
|
|
|
|
|
# print('pass') |
|
|
|
else: |
|
|
|
else: |
|
|
|
|
|
|
|
print(rel) |
|
|
|
data = { |
|
|
|
data = { |
|
|
|
'release': rel, |
|
|
|
'release': rel, |
|
|
|
'short_release': rel.replace('origin/', ''), |
|
|
|
'short_release': rel.replace('origin/', ''), |
|
|
|