Mercurial > public > mercurial-scm > hg
diff hgext/largefiles/lfutil.py @ 18998:d035c3902111
largefiles: refactoring - create destination dir in lfutil.link
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Mon, 15 Apr 2013 23:32:33 +0200 |
parents | 9717a326d270 |
children | c1b5f9c4d989 |
line wrap: on
line diff
--- a/hgext/largefiles/lfutil.py Tue Apr 09 23:40:11 2013 +0900 +++ b/hgext/largefiles/lfutil.py Mon Apr 15 23:32:33 2013 +0200 @@ -39,6 +39,7 @@ return lfsize def link(src, dest): + util.makedirs(os.path.dirname(dest)) try: util.oslink(src, dest) except OSError: @@ -86,7 +87,6 @@ elif inusercache(repo.ui, hash): repo.ui.note(_('found %s in system cache\n') % hash) path = storepath(repo, hash) - util.makedirs(os.path.dirname(path)) link(usercachepath(repo.ui, hash), path) return path return None @@ -203,10 +203,10 @@ def copytostoreabsolute(repo, file, hash): - util.makedirs(os.path.dirname(storepath(repo, hash))) if inusercache(repo.ui, hash): link(usercachepath(repo.ui, hash), storepath(repo, hash)) elif not getattr(repo, "_isconverting", False): + util.makedirs(os.path.dirname(storepath(repo, hash))) dst = util.atomictempfile(storepath(repo, hash), createmode=repo.store.createmode) for chunk in util.filechunkiter(open(file, 'rb')): @@ -217,7 +217,6 @@ def linktousercache(repo, hash): path = usercachepath(repo.ui, hash) if path: - util.makedirs(os.path.dirname(path)) link(storepath(repo, hash), path) def getstandinmatcher(repo, pats=[], opts={}):