Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

merge: support 'identical' on overlapped data#44

Open
MarcFinetRtone wants to merge 1 commit into
python-intelhex:master from
MarcFinetRtone:new-check-for-overlapping-data
Open

merge: support 'identical' on overlapped data #44
MarcFinetRtone wants to merge 1 commit into
python-intelhex:master from
MarcFinetRtone:new-check-for-overlapping-data

Conversation

@MarcFinetRtone

@MarcFinetRtone MarcFinetRtone commented Jul 9, 2020

Copy link
Copy Markdown

When merging multiple .hex files, in case of overlap we sometimes need to
just 'ensure' that values are identical.

The new 'check' mode ensures this.

Note: the behavior for start_addr is currently a 'check' (i.e. the
overlap configuration is checked only when values differ). So we might
want to change the behavior for data too:

  • if data is identical: silently bail out
  • add a 'stricter' mode that corresponds to the current behavior

@The-42 The-42 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea, but I'm a bit divided about whether we should call it "check". This verb does not state what is checked and could easily misinterpreted as "check if there are overlaps, then explode".
How about "identical" instead?

Comment thread intelhex/__init__.py Outdated
if other is self:
raise ValueError("Can't merge itself")
if overlap not in ('error', 'ignore', 'replace'):
if overlap not in ('error', 'ignore', 'replace', 'check'):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please amend the method's documentation a couple lines higher as well

@MarcFinetRtone MarcFinetRtone Dec 30, 2020

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that identical is clearer than check (even if it's not a verb as for other methods).

Comment thread intelhex/test.py
self.assertRaisesMsg(intelhex.AddressOverlapError,
'Data at address 0x0 is different: 0x1 vs. 0x2',
ih1.merge, ih2, overlap='check')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test in itself looks legit, but the test_merge_wrong_args right above this one now yields an incomplete message if triggered. Please add the new argument into that message and make it work again.

@MarcFinetRtone MarcFinetRtone Dec 30, 2020

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hum, seems that I didn't play the test... Any it's fixed.

I also updated the docs/

@MarcFinetRtone MarcFinetRtone force-pushed the new-check-for-overlapping-data branch 2 times, most recently from 311e9b3 to 855fe8b Compare December 30, 2020 15:07
@MarcFinetRtone MarcFinetRtone changed the title (削除) merge: support 'check' on overlapped data (削除ここまで) (追記) merge: support 'identical' on overlapped data (追記ここまで) Dec 30, 2020

Copy link
Copy Markdown
Author

v2:

  • replace 'check' with 'identical'
  • fix test
  • fix doc

When merging multiple .hex files, in case of overlap we sometimes need to
just 'ensure' that values are identical.
The new 'identical' mode ensures this.
Note: the behavior for start_addr is currently a 'identical' (i.e. the
overlap configuration is checked only when values differ). So we might
want to change the behavior for data too:
- if data is identical: silently bail out
- add a 'stricter' mode that corresponds to the current behavior
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@The-42 The-42 Awaiting requested review from The-42

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /