fix in updater

This commit is contained in:
Mario Voigt 2024-01-25 16:57:49 +01:00
parent a7776e7595
commit 9429706fb6
2 changed files with 13 additions and 12 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
<name>About/Upgrade MightyScape</name>
<id>fablabchemnitz.de.about_upgrade_mightyscape</id>
<name>About/Upgrade MightyScape</name>
<id>fablabchemnitz.de.about_upgrade_mightyscape</id>
<image>../000_Mightyscape.svg</image>
<param name="tab" type="notebook">
<page name="tab_settings" gui-text="Upgrade Options">
@ -10,7 +10,7 @@
<param name="convert_to_git" type="bool" gui-text="Convert to .git" gui-description="If you downloaded MightyScape as .zip or .tar.gz you cannot upgrade using this extension. But you can convert your downloaded directory to a .git one by enabling this option">false</param>
<param name="recreate_remotes" type="bool" gui-text="Recreate remotes" gui-description="Update remotes in git config file (useful if you have an older version of MightyScape or if something changes). Warning: might drop passwords/auth tokens!">false</param>
<param name="stash_untracked" type="bool" gui-text="Stash untracked files" gui-description="Enable to drop your local changes">false</param>
<param name="stash_untracked" type="bool" gui-text="Stash untracked files/back to origin" gui-description="Enable to drop your local changes. If HEAD is not attached or unchaged files block a git pull.">false</param>
<label>Click "Apply" to upgrade MightyScape to recent version!</label>
<spacer />
<label appearance="header">Hint: Zip File Mirror</label>
@ -40,12 +40,12 @@
</page>
</param>
<effect needs-live-preview="false">
<object-type>all</object-type>
<effects-menu>
<submenu name="FabLab Chemnitz"/>
</effects-menu>
</effect>
<script>
<command location="inx" interpreter="python">about_upgrade_mightyscape.py</command>
</script>
<object-type>all</object-type>
<effects-menu>
<submenu name="FabLab Chemnitz"/>
</effects-menu>
</effect>
<script>
<command location="inx" interpreter="python">about_upgrade_mightyscape.py</command>
</script>
</inkscape-extension>

View File

@ -72,7 +72,7 @@ class AboutUpgradeMightyScape(inkex.EffectExtension):
inkex.utils.debug("Nothing to do! MightyScape is already up to date!")
except git.exc.GitCommandError as e:
if "Your local changes to the following files would be overwritten by merge" in e:
if "Your local changes to the following files would be overwritten by merge" in str(e):
inkex.utils.debug("Please save or stash your local git changes first and try again. You can enable 'Stash untracked files' to continue.")
else:
inkex.utils.debug("Error: ")
@ -142,6 +142,7 @@ class AboutUpgradeMightyScape(inkex.EffectExtension):
#drop local changed. update might fail if file changes are present
if so.stash_untracked is True:
local_repo.git.stash('save')
local_repo.git.checkout('origin/master')
existingRemotes = [] #check for existing remotes. if one is missing, add it (or delete and recreate)
for r in local_repo.remotes: