Chromium Code Reviews| Index: git_cache.py |
| diff --git a/git_cache.py b/git_cache.py |
| index 086b479b81b5680ce56b6742f6cf17a53b7a2720..9ade6746363eb9455327ec97483fa7581ab950d6 100755 |
| --- a/git_cache.py |
| +++ b/git_cache.py |
| @@ -361,6 +361,18 @@ class Mirror(object): |
| gsutil.call('cp', tmp_zipfile, dest_name) |
| os.remove(tmp_zipfile) |
| + @staticmethod |
| + def DeleteTmpPackFiles(path): |
| + pack_dir = os.path.join(path, 'objects', 'pack') |
| + pack_files = [f for f in os.listdir(pack_dir) if |
| + f.startswith('.tmp-') or f.startswith('tmp_pack_')] |
|
iannucci
2014/06/10 23:09:08
since the name of the file is <hex>.{idx,pack}, wh
szager1
2014/06/10 23:38:27
Hmm... Maybe. I'm a bit paranoid.
|
| + for f in pack_files: |
| + f = os.path.join(pack_dir, f) |
| + try: |
| + os.remove(f) |
| + logging.warn('Deleted stale temporary pack file %s' % f) |
| + except OSError: |
| + logging.warn('Unable to delete temporary pack file %s' % f) |
| @staticmethod |
| def BreakLocks(path): |