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

Unified Diff: cms/sources.py

Issue 29347181: Issue 4217 - Fix Prefix Regression Due To Mercurial Version Behavior Change (Closed)
Patch Set: adds format operator to string forat Created July 1, 2016, 11:59 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cms/sources.py
===================================================================
--- a/cms/sources.py
+++ b/cms/sources.py
@@ -201,17 +201,17 @@
def read_include(self, include, format):
return self.read_file(self.include_filename(include, format))
class MercurialSource(Source):
def __init__(self, repo):
command = ['hg', '-R', repo, 'archive', '-r', 'default',
- '-t', 'uzip', '-p', '.', '-']
+ '-t', 'uzip', '-p', 'root', '-']
data = subprocess.check_output(command)
self._archive = zipfile.ZipFile(StringIO(data), mode='r')
command = ['hg', '-R', repo, 'id', '-n', '-r', 'default']
self.version = subprocess.check_output(command).strip()
self._name = os.path.basename(repo.rstrip(os.path.sep))
@@ -222,29 +222,29 @@
self.close()
return False
def close(self):
self._archive.close()
def has_file(self, filename):
try:
- self._archive.getinfo('./%s' % filename)
+ self._archive.getinfo('root/' + filename)
except KeyError:
return False
return True
def read_file(self, filename, binary=False):
- data = self._archive.read('./%s' % filename)
+ data = self._archive.read('root/' + filename)
if not binary:
data = data.decode('utf-8')
return (data, '%s!%s' % (self._name, filename))
def list_files(self, subdir):
- prefix = './%s/' % subdir
+ prefix = 'root/{}/'.format(subdir)
for filename in self._archive.namelist():
if filename.startswith(prefix):
yield filename[len(prefix):]
if os.name == 'posix':
def get_cache_dir(self):
return '/var/cache/' + self._name
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld