OCA / oca-port

Tool for porting Odoo modules changes from one version to another
GNU Lesser General Public License v3.0
30 stars 21 forks source link

Allow to work on local branches #18

Open simahawk opened 1 year ago

simahawk commented 1 year ago

Use local branches by default and require to use $remote/$branch explicitly.

For instance:

oca-port 14.0 15.0 queue_job --fork camptocamp

Will work w/ 14.0 and 15.0 local branches rather than remote. A proper log msg would be shown as you must ensure that your branches are up to date.

oca-port origin/14.0 origin/15.0 queue_job --fork camptocamp

Will work w/ remote branches only.

oca-port origin/14.0 15.0 queue_job --fork camptocamp

Will work w/ remote 14.0 and local 15.0.

This helps starting from your local changes (such as blacklisted PRs, etc) w/o having to open and merge intermediary PRs. At the moment the best way for porting several PRs and blacklist others is to:

  1. first blacklist all the PRs that you don't want to port and ignore the others
  2. open a PR w/ only the PRs to blacklist. Eg: https://github.com/OCA/queue/pull/517
  3. merge it fast and get back to the porting
sebalix commented 1 year ago

We could add a --fetch option that will leverage the upstream value to update remote branches. Or maybe --pull to also update the local branches, as the commit comparison (and creation of development branches) will be processed from the local branches if we go this way.

sebalix commented 1 year ago

I added the --fetch option here: https://github.com/OCA/oca-port/pull/26 but regarding the ability of using local branches this will require more work so it'll be done later.

With the linked PR, the tool will only try to fetch the source & target remote branches if it can't find any references locally, and with the --fetch option it'll always update the remote branches (current behavior, which slow down the process a bit). This option alone allows to analyze ~400 addons among 55 repositories in ~30m instead of 1h30m (fetch used one time per repository).

Regarding the --pull it was a bad idea, I don't want to integrate this feature as the tool is designed to do its stuff in its own branches, and won't update other local branches (it is the responsability of the user to update/rebase its local branches).