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

Side by Side Diff: cms/sources.py

Issue 29400555: Issue 4992 - Adds optional revision arg to generate_static_pages (Closed) Base URL: https://hg.adblockplus.org/cms
Patch Set: fixed redundant sys.argv definition Created April 4, 2017, 6:59 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cms/bin/generate_static_pages.py ('k') | tests/conftest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # This file is part of the Adblock Plus web scripts, 1 # This file is part of the Adblock Plus web scripts,
2 # Copyright (C) 2006-2017 eyeo GmbH 2 # Copyright (C) 2006-2017 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 return 'includes/%s.%s' % (include, format) 201 return 'includes/%s.%s' % (include, format)
202 202
203 def has_include(self, include, format): 203 def has_include(self, include, format):
204 return self.has_file(self.include_filename(include, format)) 204 return self.has_file(self.include_filename(include, format))
205 205
206 def read_include(self, include, format): 206 def read_include(self, include, format):
207 return self.read_file(self.include_filename(include, format)) 207 return self.read_file(self.include_filename(include, format))
208 208
209 209
210 class MercurialSource(Source): 210 class MercurialSource(Source):
211 def __init__(self, repo): 211 def __init__(self, repo, revision):
212 command = ['hg', '-R', repo, 'archive', '-r', 'default', 212 command = ['hg', '-R', repo, 'archive', '-r', revision,
213 '-t', 'uzip', '-p', 'root', '-'] 213 '-t', 'uzip', '-p', 'root', '-']
214 data = subprocess.check_output(command) 214 data = subprocess.check_output(command)
215 self._archive = zipfile.ZipFile(StringIO(data), mode='r') 215 self._archive = zipfile.ZipFile(StringIO(data), mode='r')
216 216
217 command = ['hg', '-R', repo, 'id', '-n', '-r', 'default'] 217 command = ['hg', '-R', repo, 'id', '-n', '-r', revision]
218 self.version = subprocess.check_output(command).strip() 218 self.version = subprocess.check_output(command).strip()
219 219
220 self._name = os.path.basename(repo.rstrip(os.path.sep)) 220 self._name = os.path.basename(repo.rstrip(os.path.sep))
221 221
222 def __enter__(self): 222 def __enter__(self):
223 return self 223 return self
224 224
225 def __exit__(self, type, value, traceback): 225 def __exit__(self, type, value, traceback):
226 self.close() 226 self.close()
227 return False 227 return False
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 path = os.path.join(dir, filename) 296 path = os.path.join(dir, filename)
297 if os.path.isfile(path): 297 if os.path.isfile(path):
298 result.append(relpath + filename) 298 result.append(relpath + filename)
299 elif os.path.isdir(path): 299 elif os.path.isdir(path):
300 do_list(path, relpath + filename + '/') 300 do_list(path, relpath + filename + '/')
301 do_list(self.get_path(subdir), '') 301 do_list(self.get_path(subdir), '')
302 return result 302 return result
303 303
304 def get_cache_dir(self): 304 def get_cache_dir(self):
305 return os.path.join(self._dir, 'cache') 305 return os.path.join(self._dir, 'cache')
OLDNEW
« no previous file with comments | « cms/bin/generate_static_pages.py ('k') | tests/conftest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld