The OCA (Odoo Community Association) has a new tool: OCA port. It helps forward porting and back porting changes on modules from one branch to another, making module maintenance and migration easier.
Story
It all started with the migration of an Odoo project composed of roughly ~350 OCA modules from 13.0 to 14.0 back in 2021. As usual with big migrations on active projects, new fixes and improvements were added from time to time even after the migration process began, making already migrated modules on 14.0 outdated.
To handle this migration we needed to:
- migrate OCA modules from 13.0 to 14.0 (as usual),
- port all fixes and features done in 13.0 on the already migrated 14.0 modules
- (even more important) make it easy & comfortable for the developer
That's how oca-port was born!
Quick example
Go to a local copy of a repository. Let’s say you want to check if the whole module can be migrated or if some changes need to be ported to the targeted version:
$ cd path/to/OCA/stock-logistics-workflow
$ oca-port 14.0 15.0 stock_split_picking
Resulting in this kind of report:
stock_split_picking already exists on 15.0, checking PRs to port...
1 pull request(s) related to 'stock_split_picking' to port from origin/14.0 to origin/15.0
1) PR #935 (https://github.com/OCA/stock-logistics-workflow/pull/935) [14.0][FW] stock_split_picking: Port PR from 13.0 to 14.0:
By sonhd91, merged at 2021-12-20T08:21:17Z
=> Not ported: stock_split_picking
=> 2 commit(s) not (fully) ported
To process the migration (or the port of missing changes), you pass the fork of the repository on which you have write access (this is the name of your git remote, be sure to add it first):
$ git remote add camptocamp git@github.com:camptocamp/stock-logistics-workflow.git
$ oca-port 14.0 15.0 stock_split_picking --fork=camptocamp
The same report will be displayed but this time with a user prompt:
[...same report than above...]
- Port PR #935 (https://github.com/OCA/stock-logistics-workflow/pull/935) [14.0][FW] stock_split_picking: Port PR from 13.0 to 14.0...
Port it? [y/N]:
Let's port these changes by answering 'yes':
- Port PR #935 (https://github.com/OCA/stock-logistics-workflow/pull/935) [14.0][FW] stock_split_picking: Port PR from 13.0 to 14.0...
Port it? [y/N]: y
Create branch oca-port-pr-935-from-14.0-to-15.0 from origin/14.0...
Apply ba5840f8 [FIX] stock_split_picking: README...
Apply 2aeeffcf [IMP] stock_split_picking: allow splitting ppickings waiting for other operations...
🎉 Last PR processed! 🎉
Push branch 'oca-port-pr-935-from-14.0-to-15.0' to remote 'camptocamp'? [y/N]: y
Create a draft PR from 'oca-port-pr-935-from-14.0-to-15.0' to '15.0' against OCA/stock-logistics-workflow? [y/N]: y
PR created => https://github.com/OCA/stock-logistics-workflow/pull/1058
Roadmap
Blacklist modules and pull requests that shouldn’t be migrated and share this with other contributors by saving these data in a file part of the repository.
Improve its usage as a Python package and generate the output as JSON or CSV (this will help to get a report of things that still need to be ported for a bunch of modules for instance, and estimate the work)
Visit https://github.com/OCA/oca-port for more details and options!
Contributors of this post:
- Sébastien Alix
- Simone Orsi
- Damien Crier
- Gilles Cherix
- Denis Leemann
Top comments (0)