dictdiffer icon indicating copy to clipboard operation
dictdiffer copied to clipboard

Unifier class: `unify` method returns duplicated patches

Open iulianav opened this issue 7 years ago • 0 comments

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 KeyErrors 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.

iulianav avatar Jun 22 '18 14:06 iulianav