inveniosoftware / inveniosoftware/dictdiffer

Unifier class: `unify` method returns duplicated patches

Open
#109 0 comments 0 reactions 0 assignees View on GitHub
Status: in work Type: bug
Dominant language
Python
Stars
849
Forks
99
PR merge metrics
No merged PRs in 30d

Description

Unifier class: `unify` method returns a list containing duplicated patches in the case of conflicts containing equal patches (same path).

e.g.
```
patch1 = ('remove', '', [('a', 'b')])
patch2 = ('remove', '', [('a', 'b')])
conflicts = Conflict(patch1, patch2)
conflicts.take = 'f' # can be 's' too
```

The result of calling `u.unify([patch1], [patch2], [conflicts])` will be `[patch1, patch2]` instead of `[patch1]`. This particular case can lead to `KeyError`s in case of calling `patch`, as it will try to remove the same key twice. The second time it fails as the key has already been deleted.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.