| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 1 # coding: utf-8 | 1 # coding: utf-8 |
| 2 | 2 |
| 3 # This file is part of the Adblock Plus web scripts, | 3 # This file is part of the Adblock Plus web scripts, |
| 4 # Copyright (C) 2006-2013 Eyeo GmbH | 4 # Copyright (C) 2006-2013 Eyeo GmbH |
| 5 # | 5 # |
| 6 # Adblock Plus is free software: you can redistribute it and/or modify | 6 # Adblock Plus is free software: you can redistribute it and/or modify |
| 7 # it under the terms of the GNU General Public License version 3 as | 7 # it under the terms of the GNU General Public License version 3 as |
| 8 # published by the Free Software Foundation. | 8 # published by the Free Software Foundation. |
| 9 # | 9 # |
| 10 # Adblock Plus is distributed in the hope that it will be useful, | 10 # Adblock Plus is distributed in the hope that it will be useful, |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 resetMatches(rules) | 143 resetMatches(rules) |
| 144 | 144 |
| 145 result = result.keys() | 145 result = result.keys() |
| 146 result.sort() | 146 result.sort() |
| 147 return result | 147 return result |
| 148 | 148 |
| 149 @cached(600) | 149 @cached(600) |
| 150 def getRules(): | 150 def getRules(): |
| 151 repoPath = os.path.abspath(get_config().get('subscriptions', 'repository')) | 151 repoPath = os.path.abspath(get_config().get('subscriptions', 'repository')) |
| 152 | 152 |
| 153 (data, errors) = subprocess.Popen(['hg', '-R', repoPath, 'cat', '-r', 'default ', os.path.join(repoPath, 'knownIssues')], stdout=subprocess.PIPE, stderr=subpro cess.PIPE).communicate() | 153 data = subprocess.check_output(['hg', '-q', '-R', repoPath, 'cat', '-r', 'defa ult', os.path.join(repoPath, 'knownIssues')]) |
|
Sebastian Noack
2013/07/04 13:57:51
The added -q parameter doesn't seem to have any af
Wladimir Palant
2013/07/05 11:24:33
Oops, I was a bit over-eager adding -q to all hg c
| |
| 154 if errors: | |
| 155 print >>sys.stderr, errors | |
| 156 | |
| 157 data = data.decode('utf-8').replace('\r', '').split('\n') | 154 data = data.decode('utf-8').replace('\r', '').split('\n') |
| 158 data.append('[]') # Pushes out last section | 155 data.append('[]') # Pushes out last section |
| 159 | 156 |
| 160 rules = {} | 157 rules = {} |
| 161 rulesets = [] | 158 rulesets = [] |
| 162 | 159 |
| 163 ruleset = None | 160 ruleset = None |
| 164 for line in data: | 161 for line in data: |
| 165 commentIndex = line.find('#') | 162 commentIndex = line.find('#') |
| 166 if commentIndex >= 0: | 163 if commentIndex >= 0: |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 continue | 223 continue |
| 227 | 224 |
| 228 value = ' '.join(foundAttrs) | 225 value = ' '.join(foundAttrs) |
| 229 if requiredValue != None: | 226 if requiredValue != None: |
| 230 if requiredValue != value: | 227 if requiredValue != value: |
| 231 continue | 228 continue |
| 232 value = text | 229 value = text |
| 233 | 230 |
| 234 checkMatch(rules, key, value) | 231 checkMatch(rules, key, value) |
| 235 return extractMatches(rules, rulesets, lang) | 232 return extractMatches(rules, rulesets, lang) |
| OLD | NEW |