changeset 15408:db8b0ee74025 stable

largefiles: ensure destination directory exists before findfile links to there When (1) findfile links a largefile from the user cache to the store and (2) the store directory doesn't exist yet, findfile errors out. A simple call to util.makedirs fixes it.
author Hao Lian <hao@fogcreek.com>
date Thu, 03 Nov 2011 10:59:32 -0400
parents ee112eb69d2a
children afc02adf4ded 54c0517c0fe8
files hgext/largefiles/lfutil.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/lfutil.py	Thu Nov 03 11:24:55 2011 -0500
+++ b/hgext/largefiles/lfutil.py	Thu Nov 03 10:59:32 2011 -0400
@@ -110,7 +110,9 @@
         repo.ui.note(_('Found %s in store\n') % hash)
     elif inusercache(repo.ui, hash):
         repo.ui.note(_('Found %s in system cache\n') % hash)
-        link(usercachepath(repo.ui, hash), storepath(repo, hash))
+        path = storepath(repo, hash)
+        util.makedirs(os.path.dirname(path))
+        link(usercachepath(repo.ui, hash), path)
     else:
         return None
     return storepath(repo, hash)