Chromium Code Reviews| Index: client/isolateserver.py |
| diff --git a/client/isolateserver.py b/client/isolateserver.py |
| index bde5fc89f8cc46a88e3360841a7df30e6c5d0f15..36edb0b4d68310b0ce3eb9e7ce5058dfd1914e91 100755 |
| --- a/client/isolateserver.py |
| +++ b/client/isolateserver.py |
| @@ -116,6 +116,10 @@ class Aborted(Error): |
| pass |
| +class AlreadyExists(Error): |
| + """File already exists.""" |
| + |
| + |
| def file_read(path, chunk_size=isolated_format.DISK_FILE_CHUNK, offset=0): |
| """Yields file content in chunks of |chunk_size| starting from |offset|.""" |
| with fs.open(path, 'rb') as f: |
| @@ -221,6 +225,8 @@ def create_symlinks(base_directory, files): |
| logging.warning('Ignoring symlink %s', filepath) |
| continue |
| outfile = os.path.join(base_directory, filepath) |
| + if os.path.exists(outfile): |
|
M-A Ruel
2016/06/15 17:28:27
I'm not super excited about adding another system
nodir
2016/06/15 17:53:42
Done
|
| + raise AlreadyExists('File %s already exists.' % outfile) |
| # os.symlink() doesn't exist on Windows. |
| os.symlink(properties['l'], outfile) # pylint: disable=E1101 |
| @@ -1967,8 +1973,10 @@ def fetch_isolated(isolated_hash, storage, cache, outdir): |
| # Link corresponding files to a fetched item in cache. |
| for filepath, props in remaining.pop(digest): |
| - cache.hardlink( |
| - digest, os.path.join(outdir, filepath), props.get('m')) |
| + dest = os.path.join(outdir, filepath) |
| + if os.path.exists(dest): |
|
M-A Ruel
2016/06/15 17:28:27
this one is harder to skip since the actual execut
nodir
2016/06/15 17:53:42
Acknowledged.
|
| + raise AlreadyExists('File %s already exists' % dest) |
| + cache.hardlink(digest, dest, props.get('m')) |
| # Report progress. |
| duration = time.time() - last_update |