dictdiffer icon indicating copy to clipboard operation
dictdiffer copied to clipboard

Patch only 'changes' ignore add/remove

Open disgusdad opened this issue 4 years ago • 1 comments

Need to apply values from previous dictionaries to new dictionaries that contain keys not in previous. So as to run patch but only apply the 'change' values and nothing else so current/new dictionary will still contain unique keys.

disgusdad avatar Jul 24 '21 16:07 disgusdad

Hi @disgusdad , I have similar need, but for "add" only: the "change" values are usually made by user in his/her configuration file of the application, so I do not want to overwrite it when updating the application. But I may add some additional keys/values to the file.

I add a line in the dictdiffer.patch function with one additional parameter actions_flags to select desired actions. In my case, I set actions_flags='a'. Any other combinations ('c' in your case) is supported. See my PR

ZeitgeberH avatar Jan 04 '23 20:01 ZeitgeberH