Skip to content

Migration to version 17.0

Pedro M. Baeza edited this page Nov 8, 2023 · 19 revisions

Before migrating

Tasks to do in the migration

Tasks NOT to do in the migration

  • change copyright year

    A line like this:

    # Copyright 2017 ACME Ltd - Johnny Glamour
    

    says "copyright FROM 2017". There's no need to change the year to the current one.

  • change original authors

How-to

Technical method to migrate a module from "16.0" to "17.0" branch

  • $repo: the OCA repository hosting the module
  • $module: the name of the module you want to migrate
  • $user_org: your GitHub login or organization name

Full process

  • On a shell command:
    $ git clone https://github.com/OCA/$repo -b 17.0
    $ cd $repo
    $ git checkout -b 17.0-mig-$module origin/17.0
    $ git format-patch --keep-subject --stdout origin/17.0..origin/16.0 -- $module | git am -3 --keep
    $ pre-commit run -a  # to run black, isort and prettier (ignore pylint errors at this stage)
    $ git add -A
    $ git commit -m "[IMP] $module: pre-commit stuff"  --no-verify  # it is important to do all formatting in one commit the first time
  • Check https://github.com/OCA/maintainer-tools/wiki/Merge-commits-in-pull-requests for a procedure for reducing commits from "OCA Transbot...".
  • Adapt the module to the 17.0 version following tasks to do.
  • On a shell command, type this for uploading the content to GitHub:
    $ git add --all
    $ git commit -m "[MIG] $module: Migration to 17.0"
    $ git remote add $user_org git@github.com:$user_org/$repo.git # This mode requires an SSH key in the GitHub account
    $ ... or ....
    $ git remote add $user_org https://github.com/$user_org/$repo.git # This will required to enter user/password each time
    $ git push $user_org 17.0-mig-$module --set-upstream
  • Follow the link on the command line or check in https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork how to create the pull request.
  • For being easily searchable and avoiding to duplicate efforts, please name the pull request following this pattern: [17.0][MIG] <module>: Migration to 17.0.

Troubleshooting

Sometimes, when performing these operations, the process can hang due to conflicts on the patches being applied. One of the possible problems is because a patch removes entirely a file and git am is not able to resolve this. It ends with a message error: ...: patch does not apply.

If that's your case, you can add --ignore-whitespace at the end of the git am command for allowing the patch to be applied, although there will be still conflicts to be solved, but they will be doable through standard conflict resolution system. Starting from the previous situation, you will need to do:

git am --abort
git format-patch --keep-subject --stdout origin/17.0..origin/16.0 -- <module path> | git am -3 --keep --ignore-whitespace
# resolve conflicts (for example git rm <file>)
git add --all
git am --continue