diff --git a/README.md b/README.md index c593377..1fc3d7d 100644 --- a/README.md +++ b/README.md @@ -26,38 +26,47 @@ not fully ported grouped by Pull Request and propose to port them. Syntax: - $ oca-port [options] + $ oca-port [options] $ oca-port --help To check if an addon could be migrated or to get eligible commits to port: $ export GITHUB_TOKEN= $ cd - $ oca-port origin/14.0 origin/16.0 --verbose --dry-run + $ oca-port origin/16.0 origin/18.0 --verbose --dry-run To effectively migrate the addon or port its commits, remove the `--dry-run` option so the tool will create a working local branch automatically (called destination) from the `` branch: - $ oca-port origin/14.0 origin/16.0 + $ oca-port origin/16.0 origin/18.0 You can control the destination with the `--destination` option: - $ oca-port origin/14.0 origin/16.0 --destination camptocamp/16.0-port-things + $ oca-port origin/16.0 origin/18.0 --destination camptocamp/18.0-port-things + +The module can be located in a subfolder, and the tool can be used in any kind of repository, e.g: + + $ oca-port origin/main origin/18.0-mig --source-version=16.0 --target-version=18.0 --upstream-org=camptocamp ./odoo/local-src/MY_MODULE --verbose --destination sebalix/18.0-mig-MY_MODULE + +- parameters `--source-version` and `--target-version` are mandatory as soon as + the `source`/`target` parameters cannot be recognized as Odoo versions (here + `origin/main` is hosting a `16.0` version) +- `--upstream-org` defaults to `OCA`, here we set it to `camptocamp` for GitHub API requests You can also directly blacklist a bunch of PRs on a given branch thanks to the `oca-port-pr` tool: - $ oca-port-pr blacklist OCA/wms#250,OCA/wms#251 15.0 shopfloor + $ oca-port-pr blacklist OCA/wms#250,OCA/wms#251 16.0 shopfloor You could give a more detailed reason of this blacklist with `--reason` parameter: - $ oca-port-pr blacklist OCA/wms#250,OCA/wms#251 15.0 shopfloor --reason "Refactored in 15.0, not needed anymore" + $ oca-port-pr blacklist OCA/wms#250,OCA/wms#251 16.0 shopfloor --reason "Refactored in 16.0, not needed anymore" And if the module has been moved to another repository, you can specify its remote as well: $ git remote add new_repo git@github.com:OCA/new-repo.git - $ oca-port-pr blacklist OCA/wms#250,OCA/wms#251 15.0 shopfloor --remote new_repo + $ oca-port-pr blacklist OCA/wms#250,OCA/wms#251 16.0 shopfloor --remote new_repo Migration of addon ------------------ @@ -101,7 +110,7 @@ You can also use `oca-port` as a Python package: >>> app = oca_port.App( ... source="origin/14.0", ... target="origin/16.0", -... addon="stock_move_auto_assign", +... addon_path="stock_move_auto_assign", ... upstream_org": "OCA", ... repo_path": "/home/odoo/OCA/stock-logistics-warehouse", ... output": "json", diff --git a/oca_port/utils/git.py b/oca_port/utils/git.py index d054c3b..9611bc5 100644 --- a/oca_port/utils/git.py +++ b/oca_port/utils/git.py @@ -99,7 +99,15 @@ def paths(self): """ if self._paths: return self._paths - self._paths = {CommitPath(self.addons_path, f) for f in self.files} + self._paths = set() + for f in self.files: + # Could raise "ValueError: 'f' is not in the subpath of 'addons_path'" + # in such case we ignore these files, and keep ones in 'addons_path' + try: + commit_path = CommitPath(self.addons_path, f) + except ValueError: + continue + self._paths.add(commit_path) return self._paths def _get_files(self):