fix in upgrader

This commit is contained in:
Mario Voigt 2021-06-01 16:30:00 +02:00
parent 7a7c40a4f7
commit 7cced1b41f

View File

@ -14,7 +14,7 @@ License: GNU GPL v3
import inkex import inkex
import os import os
import warnings import warnings
from datetime import datetime
class Upgrade(inkex.EffectExtension): class Upgrade(inkex.EffectExtension):
@ -65,23 +65,28 @@ class Upgrade(inkex.EffectExtension):
latestRemoteCommit = git.cmd.Git().ls_remote("https://gitea.fablabchemnitz.de/MarioVoigt/mightyscape-1.X.git", heads=True).replace('refs/heads/master','').strip() latestRemoteCommit = git.cmd.Git().ls_remote("https://gitea.fablabchemnitz.de/MarioVoigt/mightyscape-1.X.git", heads=True).replace('refs/heads/master','').strip()
localCommit = str(repo.head.commit) localCommit = str(repo.head.commit)
ref_logs = repo.head.reference.log() #ref_logs = repo.head.reference.log()
#commits = list(repo.iter_commits("master", max_count=5)) #commits = list(repo.iter_commits("master", max_count=5))
commits = list(repo.iter_commits("master")) commits = list(repo.iter_commits("master"))
self.msg("Local commit id is: " + localCommit[:7]) self.msg("Local commit id is: " + localCommit[:7])
self.msg("Latest remote commit is: " + latestRemoteCommit[:7]) self.msg("Latest remote commit is: " + latestRemoteCommit[:7])
self.msg("There are {} remote commits at the moment.".format(len(commits))) self.msg("There are {} remote commits at the moment.".format(len(commits)))
self.msg("There are {} remote ref logs at the moment.".format(len(ref_logs))) #self.msg("There are {} remote ref logs at the moment.".format(len(ref_logs)))
logList = [] commitList = []
for log in ref_logs: for commit in commits:
logList.append(log) commitList.append(commit)
logList.reverse() #commitList.reverse()
#show last 10 entries #show last 10 entries
self.msg("*"*40) self.msg("*"*40)
self.msg("Latest 10 log entries are:") self.msg("Latest 10 commits are:")
for i in range(0, 10): for i in range(0, 10):
self.msg(" - {}: {}".format(logList[i].newhexsha[:7], logList[i].message)) self.msg("{} | {} : {}".format(
datetime.utcfromtimestamp(commitList[i].committed_date).strftime('%Y-%m-%d %H:%M:%S'),
commitList[i].name_rev[:7],
commitList[i].message.strip())
)
#self.msg(" - {}: {}".format(commitList[i].newhexsha[:7], commitList[i].message))
self.msg("*"*40) self.msg("*"*40)
if localCommit != latestRemoteCommit: if localCommit != latestRemoteCommit: