What is ERP5 Forge (git client)?¶
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
Features¶
- Commit changes in ZODB to a git repository
- Possibility to commit only the changes that the user selected
- Possibility to see which files in your business template are outdated (compared to SVN)
- Revert local changes (in working copy and ZODB)
- Update local business template from a git repository
- View Diff between local business template and the repository
- View Diff between two old revisions of a file
- View git history / information for a particular file
- User-friendly / good-looking interface
- View git repository information
- Resolve Conflicted files
- List / Remove unversioned files
- Clean git lock files in case of a previous crash.
ERP5 Force Screenshot¶
How to install Forge?¶
ERP5 Forge is easy to install, you just need to do three things:
- Install erp5_forge business template if you don't already have it (located here on Gitlab)
- Restart Zope to take changes into account.
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:
/srv/slapgrid/slappart43/srv/runner/instance/slappart6/srv/erp5shared/erp5/bt5
/srv/slapgrid/slappart43/srv/runner/instance/slappart6/srv/erp5shared/erp5/product/ERP5/bootstrap
Warning: The working copies paths must be located in zope instance home (i.e: /var/lib/zope) for security reasons.
How to Commit?¶
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.
How to view Diff?¶
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.
SSL Trust and Login information¶
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.
How to revert changes? (Not recommended)¶
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.
How to update a business template from a git repository¶
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).
Important:
- You will NOT loose your local changes if you choose "Update Business Template from Git" action.
- You WILL loose local changes if you choose "Revert & Update Business Template from SVN" action. Your business template will be an exact copy of the one in Git.
This will do the following things:
- Remove all unversioned files in working copy ("Revert & Update Business Template from SVN" only)
- Revert all local changes ("Revert & Update Business Template from SVN" only).
- Revert "bt/revision" file to avoid conflicts ("Update Business Template from SVN" only).
- Remove all unversioned files in working copy that can appear when reverting previously added files.
- Update your local working copy on the hard drive ("svn up").
- Import this working copy as a business template in ZODB ("portal_templates") unless there are unresolved conflicts.
- Install this new business template and ask the user what he wants to do with modified files.
How to view file history or a diff between to old revisions?¶
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.
How to submit a diff viewed here as a patch?¶
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.
Git Troubleshooting, FAQ¶
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.
Related Articles¶