fix offline crash with updater

This commit is contained in:
Mario Voigt 2021-06-05 19:47:59 +02:00
parent 592f24aa9c
commit 7ba6dcb2d8

View File

@ -48,7 +48,7 @@ class AboutUpgradeMightyScape(inkex.EffectExtension):
if file.endswith('.inx'): if file.endswith('.inx'):
totalInx += 1 totalInx += 1
inkex.utils.debug("There are {} extension folders with {} .inx files!".format(totalFolders, totalInx)) inkex.utils.debug("Locally there are {} extension folders with {} .inx files!".format(totalFolders, totalInx))
repo = Repo(os.path.join(main_dir, ".git")) repo = Repo(os.path.join(main_dir, ".git"))
@ -62,7 +62,7 @@ class AboutUpgradeMightyScape(inkex.EffectExtension):
inkex.utils.debug("There are some untracked files in your MightyScape directory. Still trying to pull recent files from git...") inkex.utils.debug("There are some untracked files in your MightyScape directory. Still trying to pull recent files from git...")
origin = repo.remotes.origin origin = repo.remotes.origin
try:
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()
@ -104,6 +104,10 @@ class AboutUpgradeMightyScape(inkex.EffectExtension):
inkex.utils.debug("Nothing to do! MightyScape is already up to date!") inkex.utils.debug("Nothing to do! MightyScape is already up to date!")
exit(0) exit(0)
except git.exc.GitCommandError:
self.msg("Error receiving latest remote commit from git. Are you offline? Cannot continue!")
return
else: else:
inkex.utils.debug("No \".git\" directory found. Seems your MightyScape was not installed with git clone. Please see documentation on how to do that.") inkex.utils.debug("No \".git\" directory found. Seems your MightyScape was not installed with git clone. Please see documentation on how to do that.")
exit(1) exit(1)