fix updater

This commit is contained in:
Mario Voigt 2021-11-05 02:18:36 +01:00
parent 5a893daaf1
commit 2a67874edb

View File

@ -101,6 +101,7 @@ class AboutUpgradeMightyScape(inkex.EffectExtension):
remotes.append(["https://github.com/vmario89/mightyscape-1.X.git", "github"]) #copy/second remote remotes.append(["https://github.com/vmario89/mightyscape-1.X.git", "github"]) #copy/second remote
gitDir = os.path.join(main_dir, ".git") gitDir = os.path.join(main_dir, ".git")
if not os.path.exists(gitDir): if not os.path.exists(gitDir):
if so.convert_to_git is True: if so.convert_to_git is True:
local_repo = Repo.init(main_dir) local_repo = Repo.init(main_dir)
@ -110,22 +111,16 @@ class AboutUpgradeMightyScape(inkex.EffectExtension):
localRemotes.append(local_repo.create_remote(remote[1], url=remote[0])) localRemotes.append(local_repo.create_remote(remote[1], url=remote[0]))
localRemotes[0].update() localRemotes[0].update()
local_repo.index.commit('.') local_repo.index.commit('.')
if so.stash_untracked is True:
local_repo.git.stash('save')
local_repo.git.checkout('origin/master') local_repo.git.checkout('origin/master')
#git init
#git add .
#git remote add origin https://gitea.fablabchemnitz.de/FabLab_Chemnitz/mightyscape-1.X.git
#git remote add github https://github.com/vmario89/mightyscape-1.X.git
#git remote update
#git commit -m "."
#git stash
#git checkout origin/master
else: else:
inkex.utils.debug("MightyScape .git directory was not found. It seems you installed MightyScape the traditional way (by downloading and extracting from archive). Please install MightyScape using the git clone method if you want to use the upgrade function. More details can be found in the official README.") inkex.utils.debug("MightyScape .git directory was not found. It seems you installed MightyScape the traditional way (by downloading and extracting from archive). Please install MightyScape using the git clone method if you want to use the upgrade function. More details can be found in the official README.")
exit(1) exit(1)
local_repo = Repo(gitDir) local_repo = Repo(gitDir)
#drop local changed. update might fail if file changes are present
if so.stash_untracked is True:
local_repo.git.stash('save')
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)
for r in local_repo.remotes: for r in local_repo.remotes: