Description
This is one idea that came to my mind. The quick summary is to be able to do things like this:
./odoo:
defaults:
depth: 100 # Shallow clone, faster but less git merge ability
remotes:
ocb: https://github.com/OCA/OCB.git
odoo: https://github.com/odoo/odoo.git
openupgrade: https://github.com/OCA/OpenUpgrade.git
target: ocb 12.0 # I'm cloning version 12.0
merges:
- ocb 12.0
- odoo 12.0
# Here comes the meat:
patches:
- https://github.com/odoo/odoo/pull/37142.patch
diffs:
- https://github.com/odoo/odoo/pull/37187.diff # This is a PR for branch 11.0, merged on branch 12.0!
The effect of these new configuration items would be the same as executing:
# To merge patches:
curl -sSL https://github.com/odoo/odoo/pull/37142.patch | git am -3 --keep-non-patch -
# To merge diffs:
curl -sSL https://github.com/odoo/odoo/pull/37187.diff | patch -fp1
git add .
git commit -m "Merging diff https://github.com/odoo/odoo/pull/37187.diff"
The point of adding patches
is maybe not so much important because almost the same you can get with just plain git, and it shares the same limitations. For example, the depth: 100
key will make the git am
command fail if the cloned shallow repository doesn't have the parent commit.1
However, adding diffs
would enable us to merge patches that don't share parent commits. In this concrete case, I'm applying a patch for branch 11.0 on top of the 12.0 branch, without sharing a parent commit in git history. This enables both a fast repo download and a flexible merging system that doesn't depend on the present branch but only on the present code.
1 For this concrete case, if you open https://github.com/odoo/odoo/pull/37142.patch you'll see the required parent commit is 23c3fb1abce11d3d5b71cf31a3925198b53d1ea9.
@Tecnativa TT19524