Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: abp/filters/renderer.py

Issue 29884571: Issue 6945 - Add script to make filter list diffs (Closed) Base URL: https://hg.adblockplus.org/python-abp/
Patch Set: Address comments on PS4 Created Sept. 25, 2018, 11:01 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 # This file is part of Adblock Plus <https://adblockplus.org/>, 1 # This file is part of Adblock Plus <https://adblockplus.org/>,
2 # Copyright (C) 2006-present eyeo GmbH 2 # Copyright (C) 2006-present eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 latest_metadata, latest_rules = _split_list_for_diff(latest) 210 latest_metadata, latest_rules = _split_list_for_diff(latest)
211 base_metadata, base_rules = _split_list_for_diff(base) 211 base_metadata, base_rules = _split_list_for_diff(base)
212 212
213 yield '[Adblock Plus Diff]' 213 yield '[Adblock Plus Diff]'
214 for key, latest in latest_metadata.items(): 214 for key, latest in latest_metadata.items():
215 base = base_metadata.get(key) 215 base = base_metadata.get(key)
216 if not base or base.value != latest.value: 216 if not base or base.value != latest.value:
217 yield latest.to_string() 217 yield latest.to_string()
218 for key in set(base_metadata) - set(latest_metadata): 218 for key in set(base_metadata) - set(latest_metadata):
219 yield '! {}:'.format(base_metadata[key].key) 219 yield '! {}:'.format(base_metadata[key].key)
220 # The removed filters are listed first because, in case a filter is both
221 # removed and added, (and the client processes the diff in order), the
222 # filter will be added.
220 for rule in base_rules - latest_rules: 223 for rule in base_rules - latest_rules:
221 yield '- {}'.format(rule) 224 yield '- {}'.format(rule)
222 for rule in latest_rules - base_rules: 225 for rule in latest_rules - base_rules:
223 yield '+ {}'.format(rule) 226 yield '+ {}'.format(rule)
OLDNEW
« no previous file with comments | « abp/filters/diff_script.py ('k') | setup.py » ('j') | tests/test_diff_script.py » ('J')

Powered by Google App Engine
This is Rietveld