ERP5 Forge is a kind of git client / interface integrated into ERP5. It provides the main git features (commit, revert, diff, history...). It will allow the programmer to commit easily local changes in his Zope ZODB to a git repository and to update his local business template from the repository.
Table of Contents
ERP5 Forge is easy to install, you just need to do three things:
After that, ERP5 Forge is installed and a new "Git" tab should appear when you click on a business template in portal_templates - if it doesn't show up, make sure to read How To Commit from ERP5 and make sure your working directories and VCS preferences are correctly set.
Note that in Portal Preferences on the VCS tab "Working Copies" you need to provide the location of regular AND core business templates. This is why there are always at least two locations specified, eg:
Warning: The working copies paths must be located in zope instance home (i.e: /var/lib/zope) for security reasons.
Committing changes is now made really easy thanks to this interface. You just need to select the files you want to commit in the file tree, then click on "Commit Changes" button. It will prompt for a changelog message (which can NOT be empty) and commit the files after that. A default changelog message is usually advised (the last changelog message for this business template).
You can also click (mouse left button) on a file or a folder in the tree which will make a popup menu appear. From this menu, you should be able to commit this file/folder.
Diff is very similar to commit action. Two ways : select files in the tree and click on "View Diff" button or click on an item to display popup menu and select "View Diff" entry. It will display a diff similar to the one in "viewcvs". This kind of diff is very effective because it is colourful and you can see both old and new files (side by side).
Note: You can commit files from diff view. If you want to filter the files to commit, use the checkboxes on the left of each filepath. Also note, that document and image files itself will not be committed if selected from the diff view. You need to commit those from the file-tree.
You will be asked sometimes to accept a SSL certificate or to type your username/password. This information will be stored in cookies on your computer for a duration of 1 day (1 week for SSL certificate): it will NOT be stored in ZODB ! (for security reasons). You will be asked for those informations each time you trigger a git action and the cookies can not be found on your computer.
It is possible to revert changes in you local copy and in your ZODB. Revert is very similar to commit action. Two ways : select files in the tree and click on "Revert Changes" button or click on an item to display popup menu and select "Revert changes" entry.
Warning: Revert will restore files in the currently installed business template (it means the business template must be installed!). These files might not be the same as the ones in the git repository in the case the installed business template is not up to date. Please Update your installed business template before reverting changes if you don't like this behaviour.
Thanks to git interface it is now really easy to update a business template. Just click on a business template in "portal_templates" and select "Update Business Template from repositories" or "Revert & Update Business Template from Repositories" in action menu at the top of the page. Note, that you might first have to fetch changes from the remote repository and run genbt5list to update business templates in the repository (see How To Commit from ERP5).
This will do the following things:
To see a file history (list of revisions with changelogs), you need to click on a file in the tree and select "History" entry in the popup menu displayed. You will then see all the revisions for the selected file with date, author and changelogs.
You can also select two revisions and click on "View diff between revisions" button in order the see the diff between to old revisions. The default diff display the diff between the local file and SVN HEAD file. It may be useful to see the diff between two old revisions of a file.
When you click on the "Git" tab, the business template gets rebuilt and exported to the working copy. So once the diff tree gets displayed, that export is over and you can get the text diff by issuing the usual "svn diff" command in the working copy.
If you did not install the business template from the same working copy, it is very likely that the diff will be polluted by reversed patches. It would be much appreciated if you clean the diff before sending it, or at least restrict it to the files you modified.
Q: An exception is raised when I try to access Git tab in a business template, why?
If the raised exception is "Could not find 'XXX' at first level of working copies.", then it means that you have forgotten to set a working copy in your preferences or that the specified business template could not be found at the first level of the specified folder(s). It implies that you can't commit straight away a newly created business template: First, you must create a directory for this business template in your working copy
Q: I get errors during commit, why?
This is usually due to conflicts. It happens when your working copy is not up to date and when you try to commit a file that has been edited in the meantime. You should first update your local working copy, by using "Update local working copy" in action menu. If update fails, then it means that conflicts are important (same modified lines) and that you will have to manage that manually. Then, you can try to commit again and it should work this time.
Q: Isn't the diff inverted? The right part is older that the left part...
No. The left part is the repository version and the right part is your local working copy. Forge is mainly used to commit local modifications. Hence, the local working copy is supposed more recent that the git repository (although this is not always true).
Q: I see outdated files (in purple) in the tree, what should I do?
You should update the business template or at least the local working copy. This can be done using action menu at the top of the page.