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!
User avatar
yorik
Site Admin
Posts: 11020
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Git tool

Postby yorik » Tue Jun 28, 2016 8:50 pm

I recoded the Arch Git tool too (git commit 09e9c89). Now we have this:
screenshot.jpg
screenshot.jpg (156.37 KiB) Viewed 2055 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
Posts: 4995
Joined: Wed Oct 22, 2014 5:02 pm

Re: Git tool

Postby sgrogan » Tue Jun 28, 2016 8:54 pm

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.
vejmarie
Posts: 505
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: Git tool

Postby vejmarie » Tue Jun 28, 2016 8:56 pm

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

Re: Git tool

Postby triplus » Tue Jun 28, 2016 9:52 pm

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
Posts: 1755
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: Git tool

Postby Jee-Bee » Wed Jun 29, 2016 6:46 am

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
Site Admin
Posts: 11020
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Git tool

Postby yorik » Wed Jun 29, 2016 1:52 pm

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
Posts: 4995
Joined: Wed Oct 22, 2014 5:02 pm

Re: Git tool

Postby sgrogan » Wed Jun 29, 2016 2:04 pm

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
User avatar
yorik
Site Admin
Posts: 11020
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Git tool

Postby yorik » Wed Jun 29, 2016 7:47 pm

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
Posts: 8341
Joined: Mon Dec 12, 2011 4:45 pm

Re: Git tool

Postby triplus » Thu Jun 30, 2016 5:29 pm

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
Posts: 8341
Joined: Mon Dec 12, 2011 4:45 pm

Re: Git tool

Postby triplus » Thu Jun 30, 2016 5:57 pm

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.