Skip to content

Commit

Permalink
scripts: Replace deprecated pygit oid
Browse files Browse the repository at this point in the history
Remove deprecated object.oid, use object.id
https://github.com/libgit2/pygit2/blob/master/CHANGELOG.md

Signed-off-by: Jan Gałda <jan.galda@nordicsemi.no>
  • Loading branch information
jangalda-nsc authored and thst-nordic committed Aug 28, 2024
1 parent 3006c52 commit 9d6898a
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 36 deletions.
48 changes: 24 additions & 24 deletions .github/workflows/west-commands.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
22 changes: 11 additions & 11 deletions scripts/west_commands/ncs_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion scripts/west_commands/ncs_west_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 9d6898a

Please sign in to comment.