Git tool

Info about new community or project announcements, implemented features, classes, modules or APIs. Might get technical!
PLEASE DO NOT POST HELP REQUESTS OR OTHER DISCUSSIONS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Git tool

Post by yorik »

I recoded the Arch Git tool too (git commit 09e9c89). Now we have this:
screenshot.jpg
screenshot.jpg (156.37 KiB) Viewed 3794 times
Basically, you need:

1) the python-git package installed (we can see about this for windows later)
2) you must have a git repo on your computer already, and have the current file saved in it.

Then you just click menu Arch->Utilities->Git and this panel appears. There, you can:

- read the git log
- see the diff of a selected file
- commit selected files
- pull from a selected remote
- push to a selected remote

Of course this need more stuff (ability to start a new repo, create and switch branches, manage remotes etc - anyone interested in extending? :mrgreen: ) but for a simple, one-branch workflow this works well already...
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Git tool

Post by sgrogan »

yorik wrote:1) the python-git package installed (we can see about this for windows later)
It's been in the dev-snapshot bundle for a few weeks. Testing results welcome.
"fight the good fight"
User avatar
vejmarie
Posts: 713
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: Git tool

Post by vejmarie »

Hey, is this related to the "git like" question I had a few days/weeks ago ? ;)
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Git tool

Post by triplus »

Looking good.

But i do have one question. Does the Git executable need to be installed or can GitPython do this by itself?
Jee-Bee
Veteran
Posts: 2566
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: Git tool

Post by Jee-Bee »

yorik wrote:Then you just click menu Arch->Utilities->Git and this panel appears. There, you can: ...
Why is this in Arch module and not Freecad standard (just workbench independend...)
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Git tool

Post by yorik »

vejmarie wrote:Hey, is this related to the "git like" question I had a few days/weeks ago ? ;)
It was on my todo list for some time, but yeah, the more people talk about it... ;)
triplus wrote:But i do have one question. Does the Git executable need to be installed or can GitPython do this by itself?
I think gitpython uses the git executable under the hood, but I suppose it is included in windows... in linux the python-git package depends on the git package.
Jee-Bee wrote:Why is this in Arch module and not Freecad standard (just workbench independend...)
Basically I was still testing, and don't want to "pollute" the rest of FreeCAD while it's not finished. But you're right, at some point it should be migrated somewhere else.
User avatar
sgrogan
Veteran
Posts: 6499
Joined: Wed Oct 22, 2014 5:02 pm

Re: Git tool

Post by sgrogan »

yorik wrote:I think gitpython uses the git executable under the hood, but I suppose it is included in windows... in linux the python-git package depends on the git package.
Only git-python is included in the win bundle. Windows users should install the git executable using the installer from here: https://git-scm.com/download/win
"fight the good fight"
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Git tool

Post by yorik »

sgrogan wrote:Only git-python is included in the win bundle. Windows users should install the git executable using the installer from here: https://git-scm.com/download/win
Does it say something when you type in the console:

Code: Select all

import git
and you don't have git installed?

If not, we could add a warning for the user...
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Git tool

Post by triplus »

yorik wrote:
triplus wrote:But i do have one question. Does the Git executable need to be installed or can GitPython do this by itself?
I think gitpython uses the git executable under the hood, but I suppose it is included in windows... in linux the python-git package depends on the git package.
A while back i investigated this a bit and i was under the impression Git executable is needed. The licence of Git therefore isn't ideal fit for FreeCAD licence policy. But this option is the only one if we want the best possible Git support.

Alternative would be to use Dulwich and i guess porcelain API:

https://www.dulwich.io/apidocs/dulwich.porcelain.html

This approach would i guess always lack a bit against using "the real thing". But once it will have Apache licence i guess it could be packed as "FreeCAD module" and to be imported when needed for some FreeCAD Git related functionality? Anyway this are just some thoughts and lets wait and see what will the future bring. ;)
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Git tool

Post by triplus »

In pseudo code if something like this would be possible in the future and available by default:

Code: Select all

import dulwich
dulwich.porcelain.clone("git url", target='UserAppData/Mod')
That would i guess make FreeCAD "git ready". ;) And i do imagine some nice GUI dialogs would be made as a result to provide some useful features to FreeCAD users.
Post Reply