This commit is contained in:
Mario Voigt 2024-01-25 17:26:16 +01:00
parent fa29b92010
commit 0e306c045f
1 changed files with 11 additions and 5 deletions

View File

@ -29,6 +29,8 @@ except:
class AboutUpgradeMightyScape(inkex.EffectExtension): class AboutUpgradeMightyScape(inkex.EffectExtension):
restart = False
def install_requirements(self): def install_requirements(self):
requirements = inkex.utils.debug(os.path.abspath(os.path.join(self.ext_path()) + "/../../../requirements.txt")) requirements = inkex.utils.debug(os.path.abspath(os.path.join(self.ext_path()) + "/../../../requirements.txt"))
if not os.path.exists(requirements): if not os.path.exists(requirements):
@ -64,12 +66,10 @@ class AboutUpgradeMightyScape(inkex.EffectExtension):
remote_repo.pull() #finally pull new data remote_repo.pull() #finally pull new data
for info in fetch_info: #should return only one line in total for info in fetch_info: #should return only one line in total
inkex.utils.debug("Updated {} to commit id {}. {} commits were pulled".format(info.ref, str(info.commit)[:7], remoteCommitCount - localCommitCount)) inkex.utils.debug("Updated {} to commit id {}. {} commits were pulled".format(info.ref, str(info.commit)[:7], remoteCommitCount - localCommitCount))
self.restart = True
inkex.utils.debug("Please restart Inkscape to let the changes take effect.")
else: else:
inkex.utils.debug("Nothing to do! MightyScape is already up to date!") self.restart = False
except git.exc.GitCommandError as e: except git.exc.GitCommandError as e:
inkex.utils.debug("git command failed. Please save or stash your local git changes first and try again. You can enable 'Stash untracked files' to continue. This will also reset your branch to master.") inkex.utils.debug("git command failed. Please save or stash your local git changes first and try again. You can enable 'Stash untracked files' to continue. This will also reset your branch to master.")
@ -140,6 +140,7 @@ class AboutUpgradeMightyScape(inkex.EffectExtension):
if so.stash_untracked is True: if so.stash_untracked is True:
local_repo.git.stash('save') local_repo.git.stash('save')
local_repo.git.checkout('master') local_repo.git.checkout('master')
self.restart = True
#local_repo.git.checkout('origin/master') #local_repo.git.checkout('origin/master')
existingRemotes = [] #check for existing remotes. if one is missing, add it (or delete and recreate) existingRemotes = [] #check for existing remotes. if one is missing, add it (or delete and recreate)
@ -191,6 +192,11 @@ class AboutUpgradeMightyScape(inkex.EffectExtension):
inkex.utils.debug("Error receiving latest remote commit from second git remote {}.\nAre you offline? Cannot continue!".format(remotes[0][0])) inkex.utils.debug("Error receiving latest remote commit from second git remote {}.\nAre you offline? Cannot continue!".format(remotes[0][0]))
exit(1) exit(1)
if self.restart is True:
inkex.utils.debug("Please restart Inkscape to let all changes take effect.")
else:
inkex.utils.debug("Nothing to do! MightyScape is already up to date!")
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)