ERP5VCS: Add support for submodules
This MR will help to be able to do basic VCS tasks (commit, diff, merge, etc.) with submodules Business Template in ERP5. This is particularly useful as we are migrating some BT5(s) such as
erp5_notebook to act as submodule which are getting large due to data files. We already have support for submodules in slapos
- Business Templates as submodule
- External Libraries as submodule
- Changes in submodule Business Template should reflect properly in the diff (f75b7c3b)
- Checkout from branch with to without submodule and vice-versa is creating issue. (Use post-checkout hook https://ttboj.wordpress.com/2014/05/06/keeping-git-submodules-in-sync-with-your-branches/)
@jm started a discussion on an outdated diffproduct/ERP5VCS/WorkingCopy.py
396 396 removed_set = set() 397 397 prefix_length = len(os.path.join(self.path, '')) 398 398 for dirpath, dirnames, filenames in os.walk(self.path): 399 # Do not remove hidden files and folders. 400 # This is important as we primarily use ERP5 VCS for Business Templates 401 # and sometimes they can be in form of git submodule. Removing `.git` 402 # leads to the case where we want to check from parent repo (i.e. erp5) 403 # if there is an existence of gitsubmodule and then update it explicitly. 404 # This ends up taking an extra effort and conflict as the new `.git` 405 # might have conflicting history depending on when we re-init/udpate 406 # the submodule 407 filenames = [f for f in filenames if not f == '.']
In ERP5VCS, we use commit changes to commit the BT5 changes in 1 step, like here:
But with submodule it needs to be done in 2 steps:
- Commit the changes in the bt5 repository
- Commit the version up for the bt5 (acting as submodule) in erp5 repo.
With @jm we discussed that we can provide an extra checkbox in
BusinessTemplate_doVcsCommitto version up the submodule commit in erp5 repository. Something like this(with better naming):
This will allow to again keep the commit process in single step, difference being that now we will have 2 commits.
For example in ERP5 repo, we will have something like
erp5.git <parent_revision_1> bt5/ erp5_notebook @ <submodule_revision_1>/ (submodule pointing to bt5-erp5_notebook.git)
Now changes in
erp5_notebookBT5 and commiting it with ERP5 VCS UI will change the revisions to:
erp5.git <version up erp5_notebook BT5 to submodule_revision_2> bt5/ erp5_notebook @ <submodule_revision_2>/ (submodule pointing to bt5-erp5_notebook.git)
What are your opinions on this
closedToggle commit list
In the end, we decided not to do submodules and just add clone more repositories in slapos. This can be closed I think.