reworked updater logic
This commit is contained in:
parent
8be3f56e94
commit
87905b485a
@ -33,33 +33,15 @@ class AboutUpgradeMightyScape(inkex.EffectExtension):
|
|||||||
try:
|
try:
|
||||||
localCommit = local_repo.head.commit
|
localCommit = local_repo.head.commit
|
||||||
remote_repo = git.remote.Remote(local_repo, 'origin')
|
remote_repo = git.remote.Remote(local_repo, 'origin')
|
||||||
remoteCommit = remote_repo.fetch()[0].commit
|
remoteCommit = remote_repo.fetch()[0].commit
|
||||||
|
self.msg("Latest remote commit is: " + str(remoteCommit)[:7])
|
||||||
|
|
||||||
authors = []
|
authors = []
|
||||||
# for every remote commit
|
# for every remote commit
|
||||||
while remoteCommit.hexsha != localCommit.hexsha:
|
while remoteCommit.hexsha != localCommit.hexsha:
|
||||||
authors.append(remoteCommit.author.email)
|
authors.append(remoteCommit.author.email)
|
||||||
remoteCommit = remoteCommit.parents[0]
|
remoteCommit = remoteCommit.parents[0]
|
||||||
|
|
||||||
#local_commits = list(local_repo.iter_commits("master", max_count=5))
|
|
||||||
local_commits = list(local_repo.iter_commits("master"))
|
|
||||||
self.msg("Local commit id is: " + str(localCommit)[:7])
|
|
||||||
self.msg("Latest remote commit is: " + str(remoteCommit)[:7])
|
|
||||||
self.msg("There are {} local commits at the moment.".format(len(local_commits)))
|
|
||||||
localCommitList = []
|
|
||||||
for local_commit in local_commits:
|
|
||||||
localCommitList.append(local_commit)
|
|
||||||
#localCommitList.reverse()
|
|
||||||
self.msg("*"*40)
|
|
||||||
self.msg("Latest 10 local commits are:")
|
|
||||||
for i in range(0, 10):
|
|
||||||
self.msg("{} | {} : {}".format(
|
|
||||||
datetime.utcfromtimestamp(localCommitList[i].committed_date).strftime('%Y-%m-%d %H:%M:%S'),
|
|
||||||
localCommitList[i].name_rev[:7],
|
|
||||||
localCommitList[i].message.strip())
|
|
||||||
)
|
|
||||||
#self.msg(" - {}: {}".format(localCommitList[i].newhexsha[:7], localCommitList[i].message))
|
|
||||||
self.msg("*"*40)
|
|
||||||
|
|
||||||
if localCommit.hexsha != remoteCommit.hexsha:
|
if localCommit.hexsha != remoteCommit.hexsha:
|
||||||
ssh_executable = 'git'
|
ssh_executable = 'git'
|
||||||
with local_repo.git.custom_environment(GIT_SSH=ssh_executable):
|
with local_repo.git.custom_environment(GIT_SSH=ssh_executable):
|
||||||
@ -126,6 +108,26 @@ class AboutUpgradeMightyScape(inkex.EffectExtension):
|
|||||||
remotes.append("https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.X.git") #main
|
remotes.append("https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.X.git") #main
|
||||||
remotes.append("https://github.com/vmario89/mightyscape-1.X.git") #copy/second remote
|
remotes.append("https://github.com/vmario89/mightyscape-1.X.git") #copy/second remote
|
||||||
|
|
||||||
|
localCommit = local_repo.head.commit
|
||||||
|
#local_commits = list(local_repo.iter_commits("master", max_count=5))
|
||||||
|
localCommits = list(local_repo.iter_commits("master"))
|
||||||
|
self.msg("Local commit id is: " + str(localCommit)[:7])
|
||||||
|
self.msg("There are {} local commits at the moment.".format(len(localCommits)))
|
||||||
|
localCommitList = []
|
||||||
|
for local_commit in localCommits:
|
||||||
|
localCommitList.append(localCommit)
|
||||||
|
#localCommitList.reverse()
|
||||||
|
self.msg("*"*40)
|
||||||
|
self.msg("Latest 10 local commits are:")
|
||||||
|
for i in range(0, 10):
|
||||||
|
self.msg("{} | {} : {}".format(
|
||||||
|
datetime.utcfromtimestamp(localCommitList[i].committed_date).strftime('%Y-%m-%d %H:%M:%S'),
|
||||||
|
localCommitList[i].name_rev[:7],
|
||||||
|
localCommitList[i].message.strip())
|
||||||
|
)
|
||||||
|
#self.msg(" - {}: {}".format(localCommitList[i].newhexsha[:7], localCommitList[i].message))
|
||||||
|
self.msg("*"*40)
|
||||||
|
|
||||||
#finally run the update
|
#finally run the update
|
||||||
success = self.update(local_repo, remotes[0])
|
success = self.update(local_repo, remotes[0])
|
||||||
if success is False: #try the second remote if first failed
|
if success is False: #try the second remote if first failed
|
||||||
|
Reference in New Issue
Block a user