Add ons manager - development and bugs topic

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Add ons manager - git history

Post by Zolko »

Hello,

currently, using the AddonManager on a workbench, the entire git history - in the .git subdirectory - is pulled from GitHub. For the Assembly4 WB for example, that means that 34Mb are pulled, of which 28Mb are in the .git directory and represent the entire past development history. While the git history is important for development contributors, it is of zero value for most users. This will, in time, with continuous development, only get worse.

Wouldn't it make sense for the AddonManager to only pull the current snapshot of the repository ? Using git archive instead of git clone probably (though I'm not a specialist)
try the Assembly4 workbench for FreCAD — tutorials here and here
User avatar
kkremitzki
Veteran
Posts: 2518
Joined: Thu Mar 03, 2016 9:52 pm
Location: Illinois

Re: Add ons manager - development and bugs topic

Post by kkremitzki »

Could also do git clone --depth=1
Like my FreeCAD work? I'd appreciate any level of support via Patreon, Liberapay, or PayPal! Read more about what I do at my blog.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Add ons manager - development and bugs topic

Post by Kunda1 »

kkremitzki wrote: Wed Sep 16, 2020 11:09 am Could also do git clone --depth=1
maybe we could offer the possibility for folks to roll-back one or 2 commits if the upstream dev has introduced a fatal bug or something ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Add ons manager - git history

Post by vocx »

Zolko wrote: Wed Sep 16, 2020 8:15 am currently, using the AddonManager on a workbench...
This Addon Manager in my opinion requires quite a lot of work to make it more modular.

I recommend more people test this Extension Manager, a new workbench that serves as a replacement. It could eventually become the official manager.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Add ons manager - git history

Post by Zolko »

Zolko wrote: Wed Sep 16, 2020 8:15 am Wouldn't it make sense for the AddonManager to only pull the current snapshot of the repository ?
vocx wrote: Wed Sep 16, 2020 4:04 pm I recommend more people test this Extension Manager, a new workbench
May-be, but if it's only a 1-liner to improve the current AddonManager, then we shouldn't wait for the next big thing:

kkremitzki wrote: Wed Sep 16, 2020 11:09 am Could also do git clone --depth=1
Would that still allow to detect when a workbench is outdated ? Who could do this modification ?
try the Assembly4 workbench for FreCAD — tutorials here and here
Syres
Veteran
Posts: 2902
Joined: Thu Aug 09, 2018 11:14 am

Re: Add ons manager - git history

Post by Syres »

Zolko wrote: Thu Sep 17, 2020 10:08 am Would that still allow to detect when a workbench is outdated ?
Try changing line 643 of src\Mod\AddonManager\addonmanager_workers.py from:

Code: Select all

                        answer = repo.pull() + "\n\n" + translate("AddonsInstaller", "Workbench successfully updated. Please restart FreeCAD to apply the changes.")
to:

Code: Select all

                        answer = repo.pull('--depth=1') + "\n\n" + translate("AddonsInstaller", "Workbench successfully updated. Please restart FreeCAD to apply the changes.")
and line 663 from:

Code: Select all

                        repo = git.Repo.clone_from(self.repos[idx][1], clonedir, branch='master')
to:

Code: Select all

                       repo = git.Repo.clone_from(self.repos[idx][1], clonedir, branch='master', depth=1)
I see the total size for Assembly4 being 11.2Mb using this method. You can then test the update with a minor change to your Wb on Github.
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Add ons manager - git history

Post by Zolko »

Syres wrote: Thu Sep 17, 2020 11:25 am
Zolko wrote: Thu Sep 17, 2020 10:08 am Would that still allow to detect when a workbench is outdated ?
Try changing line 643 of src\Mod\AddonManager\addonmanager_workers.py to:

Code: Select all

answer = repo.pull('--depth=1') + "\n\n" + translate("AddonsInstaller", "Workbench successfully updated. Please restart FreeCAD to apply the changes.")
and line 663 to:

Code: Select all

 repo = git.Repo.clone_from(self.repos[idx][1], clonedir, branch='master', depth=1)
 
I see the total size for Assembly4 being 11.2Mb using this method. You can then test the update with a minor change to your Wb on Github.
yes, that works, nice, thank-you. But I se that the .git directory is still 5.2Mb, used by a unique file .git/objects/pack/pack-***.pack. Isn't it possible to get rid of that one also ?
try the Assembly4 workbench for FreCAD — tutorials here and here
Syres
Veteran
Posts: 2902
Joined: Thu Aug 09, 2018 11:14 am

Re: Add ons manager - git history

Post by Syres »

Zolko wrote: Thu Sep 17, 2020 12:55 pm the .git directory is still 5.2Mb, used by a unique file .git/objects/pack/pack-***.pack. Isn't it possible to get rid of that one also ?
I don't know, just trying to implement what @kkremitzki suggested, my git knowledge can be written on a postage stamp with a large marker pen.
Post Reply