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.
User avatar
Zolko
Posts: 1103
Joined: Mon Dec 17, 2018 10:02 am

Re: Add ons manager - git history

Postby Zolko » Wed Sep 16, 2020 8:15 am

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 v0.19
install with Tools > Addon Manager > Assembly4 — tutorials here and here
User avatar
kkremitzki
Posts: 2168
Joined: Thu Mar 03, 2016 9:52 pm
Location: Texas

Re: Add ons manager - development and bugs topic

Postby kkremitzki » Wed Sep 16, 2020 11:09 am

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
Posts: 8772
Joined: Thu Jan 05, 2017 9:03 pm

Re: Add ons manager - development and bugs topic

Postby Kunda1 » Wed Sep 16, 2020 11:16 am

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 ?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
vocx
Posts: 5206
Joined: Thu Oct 18, 2018 9:18 pm

Re: Add ons manager - git history

Postby vocx » Wed Sep 16, 2020 4:04 pm

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
Posts: 1103
Joined: Mon Dec 17, 2018 10:02 am

Re: Add ons manager - git history

Postby Zolko » Thu Sep 17, 2020 10:08 am

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 v0.19
install with Tools > Addon Manager > Assembly4 — tutorials here and here
Syres
Posts: 819
Joined: Thu Aug 09, 2018 11:14 am

Re: Add ons manager - git history

Postby Syres » 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 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
Posts: 1103
Joined: Mon Dec 17, 2018 10:02 am

Re: Add ons manager - git history

Postby Zolko » Thu Sep 17, 2020 12:55 pm

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 v0.19
install with Tools > Addon Manager > Assembly4 — tutorials here and here
Syres
Posts: 819
Joined: Thu Aug 09, 2018 11:14 am

Re: Add ons manager - git history

Postby Syres » Thu Sep 17, 2020 4:11 pm

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.