modify_asset raises a NoopError when there's nothing to do.
However, this was based on a dict comparison, leading to the assessment
that there isn't anything to do, if comments were the only thing
modified.
This commit adds a comparison helper, that accounts for ruamel's
comment annotation. Builtin by ruamel operator overwrites (__eq__,
__neq__, __contains__) don't work for us, b/c a CommentToken's
start- and end markers may end up being FileMark objects. And these
contain the path to a file this was read from. Hence, comparing across
files doesn't work as we need it to, b/c assets are edited in a temp
location, so that the edited asset object is connected to a different
file path. This led to edits that change nothing but comments being
ignored by onyo edit and therefore nothing was committed.
Closes #586
Second commit is a miniscule fix of a test I stumbled upon. Not actually related to the topic above.
modify_asset
raises aNoopError
when there's nothing to do. However, this was based on a dict comparison, leading to the assessment that there isn't anything to do, if comments were the only thing modified. This commit adds a comparison helper, that accounts forruamel
's comment annotation. Builtin byruamel
operator overwrites (__eq__
,__neq__
,__contains__
) don't work for us, b/c aCommentToken
's start- and end markers may end up beingFileMark
objects. And these contain the path to a file this was read from. Hence, comparing across files doesn't work as we need it to, b/c assets are edited in a temp location, so that the edited asset object is connected to a different file path. This led to edits that change nothing but comments being ignored byonyo edit
and therefore nothing was committed.Closes #586
Second commit is a miniscule fix of a test I stumbled upon. Not actually related to the topic above.