changeset 15371:f26ed4ea46d8 stable

largefiles: remove lfutil.createdir, replace calls with util.makedirs
author Hao Lian <hao@fogcreek.com>
date Tue, 25 Oct 2011 11:45:28 -0400
parents 8af6c6d91c92
children 695ac6aca77f
files hgext/largefiles/lfcommands.py hgext/largefiles/lfutil.py hgext/largefiles/localstore.py
diffstat 3 files changed, 4 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/lfcommands.py	Wed Oct 26 14:22:19 2011 -0500
+++ b/hgext/largefiles/lfcommands.py	Tue Oct 25 11:45:28 2011 -0400
@@ -245,7 +245,7 @@
 
                 # largefile was modified, update standins
                 fullpath = rdst.wjoin(f)
-                lfutil.createdir(os.path.dirname(fullpath))
+                util.makedirs(os.path.dirname(fullpath))
                 m = util.sha1('')
                 m.update(ctx[f].data())
                 hash = m.hexdigest()
--- a/hgext/largefiles/lfutil.py	Wed Oct 26 14:22:19 2011 -0500
+++ b/hgext/largefiles/lfutil.py	Tue Oct 25 11:45:28 2011 -0400
@@ -196,10 +196,6 @@
 def instore(repo, hash):
     return os.path.exists(storepath(repo, hash))
 
-def createdir(dir):
-    if not os.path.exists(dir):
-        os.makedirs(dir)
-
 def storepath(repo, hash):
     return repo.join(os.path.join(longname, hash))
 
@@ -223,7 +219,7 @@
     copytostoreabsolute(repo, repo.wjoin(file), hash)
 
 def copytostoreabsolute(repo, file, hash):
-    createdir(os.path.dirname(storepath(repo, hash)))
+    util.makedirs(os.path.dirname(storepath(repo, hash)))
     if inusercache(repo.ui, hash):
         link(usercachepath(repo.ui, hash), storepath(repo, hash))
     else:
@@ -232,7 +228,7 @@
         linktousercache(repo, hash)
 
 def linktousercache(repo, hash):
-    createdir(os.path.dirname(usercachepath(repo.ui, hash)))
+    util.makedirs(os.path.dirname(usercachepath(repo.ui, hash)))
     link(storepath(repo, hash), usercachepath(repo.ui, hash))
 
 def getstandinmatcher(repo, pats=[], opts={}):
--- a/hgext/largefiles/localstore.py	Wed Oct 26 14:22:19 2011 -0500
+++ b/hgext/largefiles/localstore.py	Tue Oct 25 11:45:28 2011 -0400
@@ -27,7 +27,7 @@
         self.remote = remote
 
     def put(self, source, hash):
-        lfutil.createdir(os.path.dirname(lfutil.storepath(self.remote, hash)))
+        util.makedirs(os.path.dirname(lfutil.storepath(self.remote, hash)))
         if lfutil.instore(self.remote, hash):
             return
         lfutil.link(lfutil.storepath(self.repo, hash),