[PATCH] largefiles: remove lfutil.createdir, replace calls with util.makedirs

Hao Lian hao at fogcreek.com
Wed Oct 26 15:41:00 CDT 2011


# HG changeset patch
# User Hao Lian <hao at fogcreek.com>
# Date 1319557528 14400
# Branch stable
# Node ID 8fee2bc0d35916dd38231e97bfa7ef77f53b215d
# Parent  b357a972d6cd4f1554566e2f3920ab6a2344c310
largefiles: remove lfutil.createdir, replace calls with util.makedirs

diff --git a/hgext/largefiles/lfcommands.py b/hgext/largefiles/lfcommands.py
--- a/hgext/largefiles/lfcommands.py
+++ b/hgext/largefiles/lfcommands.py
@@ -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()
diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py
+++ b/hgext/largefiles/lfutil.py
@@ -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={}):
diff --git a/hgext/largefiles/localstore.py b/hgext/largefiles/localstore.py
--- a/hgext/largefiles/localstore.py
+++ b/hgext/largefiles/localstore.py
@@ -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),


More information about the Mercurial-devel mailing list