Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Unified Diff: git_cache.py

Issue 326203003: Clean up temporary git pack files when breaking locks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
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: 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):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698