diff --git a/.github/workflows/west-commands.yml b/.github/workflows/west-commands.yml index 0eb54f61bac5..810dae7eeb53 100644 --- a/.github/workflows/west-commands.yml +++ b/.github/workflows/west-commands.yml @@ -2,7 +2,7 @@ name: NCS west commands on: pull_request: - branches: [main] + branches: [ main ] paths: - scripts/west_commands/mypy.ini - scripts/west_commands/ncs_commands.py @@ -14,27 +14,27 @@ jobs: runs-on: ubuntu-latest name: Run Python checks for west commands on patch series (PR) steps: - - name: Checkout the code - uses: actions/checkout@v3 - with: - path: ncs/nrf - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - - name: cache-pip - uses: actions/cache@v3 - with: - path: ~/.cache/pip - key: ${{ runner.os }}-doc-pip - - name: Install python dependencies - working-directory: ncs/nrf - run: | - pip3 install -U pip - pip3 install -U setuptools - pip3 install -U wheel - pip3 install -U mypy types-colorama types-editdistance types-PyYAML - grep -E "west" scripts/requirements-fixed.txt | xargs pip3 install -U - pip3 show -f west - - name: Run mypy - working-directory: ncs/nrf/scripts/west_commands - run: | - python3 -m mypy --config-file mypy.ini ncs_west_helpers.py pygit2_helpers.py ncs_commands.py + - name: Checkout the code + uses: actions/checkout@v3 + with: + path: ncs/nrf + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + - name: cache-pip + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-doc-pip + - name: Install python dependencies + working-directory: ncs/nrf + run: | + pip3 install -U pip + pip3 install -U setuptools + pip3 install -U wheel + pip3 install -U mypy types-colorama types-editdistance types-PyYAML + grep -E "west==" scripts/requirements-fixed.txt | cut -f1 -d"#" | xargs pip3 install -U + pip3 show -f west + - name: Run mypy + working-directory: ncs/nrf/scripts/west_commands + run: | + python3 -m mypy --config-file mypy.ini ncs_west_helpers.py pygit2_helpers.py ncs_commands.py diff --git a/scripts/west_commands/ncs_commands.py b/scripts/west_commands/ncs_commands.py index 8297bc81515f..9c4a9afdf3f0 100644 --- a/scripts/west_commands/ncs_commands.py +++ b/scripts/west_commands/ncs_commands.py @@ -100,14 +100,14 @@ def print_likely_merged(downstream_repo: nwh.Repository, '(revert these if appropriate):', color=log.WRN_COLOR) for downstream_commit, upstream_commits in likely_merged.items(): if len(upstream_commits) == 1: - log.inf(f'- {downstream_commit.oid} {commit_title(downstream_commit)}') + log.inf(f'- {downstream_commit.id} {commit_title(downstream_commit)}') log.inf(f' Similar upstream title:\n' - f' {upstream_commits[0].oid} {commit_title(upstream_commits[0])}') + f' {upstream_commits[0].id} {commit_title(upstream_commits[0])}') else: - log.inf(f'- {downstream_commit.oid} {commit_title(downstream_commit)}\n' + log.inf(f'- {downstream_commit.id} {commit_title(downstream_commit)}\n' ' Similar upstream titles:') for i, upstream_commit in enumerate(upstream_commits, start=1): - log.inf(f' {i}. {upstream_commit.oid} {commit_title(upstream_commit)}') + log.inf(f' {i}. {upstream_commit.id} {commit_title(upstream_commit)}') else: log.dbg('no downstream patches seem to have been merged upstream') @@ -382,11 +382,11 @@ def print_loot(self, for index, commit in enumerate(loot): if self.args.files and not commit_affects_files(commit, self.args.files): - log.dbg(f"skipping {commit.oid}; it doesn't affect file filter", + log.dbg(f"skipping {commit.id}; it doesn't affect file filter", level=log.VERBOSE_VERY) continue - sha = str(commit.oid) + sha = str(commit.id) title = commit_title(commit) if self.args.sha_only: log.inf(sha) @@ -705,15 +705,15 @@ def upmerge(self, name: str, project: Project, z_project: Project) -> None: for dc, ucs in reversed(analyzer.likely_merged.items()): if len(ucs) == 1: - log.inf(f'- Reverting: {dc.oid} {commit_title(dc)}') + log.inf(f'- Reverting: {dc.id} {commit_title(dc)}') log.inf(f' Similar upstream title:\n' - f' {ucs[0].oid} {commit_title(ucs[0])}') + f' {ucs[0].id} {commit_title(ucs[0])}') else: - log.inf(f'- Reverting: {dc.oid} {commit_title(dc)}\n' + log.inf(f'- Reverting: {dc.id} {commit_title(dc)}\n' ' Similar upstream titles:') for i, uc in enumerate(ucs, start=1): - log.inf(f' {i}. {uc.oid} {commit_title(uc)}') - project.git('revert --signoff --no-edit ' + str(dc.oid)) + log.inf(f' {i}. {uc.id} {commit_title(uc)}') + project.git('revert --signoff --no-edit ' + str(dc.id)) log.inf(f'Merging: {z_rev} to project: {project.name}') msg = f"[nrf mergeup] Merge upstream automatically up to commit {z_sha}\n\nThis auto-upmerge was performed with ncs-upmerger script." project.git('merge --no-edit --no-ff --signoff -m "' + msg + '" ' + str(self.zephyr_rev)) diff --git a/scripts/west_commands/ncs_west_helpers.py b/scripts/west_commands/ncs_west_helpers.py index 13d5e2ed6ea5..7f1cf377ead6 100644 --- a/scripts/west_commands/ncs_west_helpers.py +++ b/scripts/west_commands/ncs_west_helpers.py @@ -206,7 +206,7 @@ def _downstream_outstanding_commits(self) -> list[pygit2.Commit]: # complete list of OOT patches. downstream_out: dict[str, pygit2.Commit] = {} for c in all_downstream_oot: - sha, sl = str(c.oid), commit_title(c) + sha, sl = str(c.id), commit_title(c) is_revert = title_is_revert(sl) # this is just a heuristic if len(c.parents) > 1: