changeset 114:82fb6d09f911

Simplify checkout slightly, replace checkdir with os.makedirs
author mpm@selenic.com
date Fri, 20 May 2005 17:33:24 -0800
parents 1918852a67a8
children 39b438eeb25a
files mercurial/hg.py
diffstat 1 files changed, 9 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hg.py	Fri May 20 17:31:55 2005 -0800
+++ b/mercurial/hg.py	Fri May 20 17:33:24 2005 -0800
@@ -343,35 +343,26 @@
         self.dircache.update(new)
         self.dircache.remove(remove)
 
-    def checkdir(self, path):
-        d = os.path.dirname(path)
-        if not d: return
-        if not os.path.isdir(d):
-            self.checkdir(d)
-            os.mkdir(d)
-
     def checkout(self, node):
         # checkout is really dumb at the moment
         # it ought to basically merge
         change = self.changelog.read(node)
-        mmap = self.manifest.read(change[0])
-
-        l = mmap.keys()
+        l = self.manifest.read(change[0]).items()
         l.sort()
-        stats = []
-        for f in l:
-            self.ui.note(f + "\n")
-            r = self.file(f)
-            t = r.revision(mmap[f])
+
+        for f,n in l:
+            if f[0] == "/": continue
+            self.ui.note(f, "\n")
+            t = self.file(f).revision(n)
             try:
                 file(f, "w").write(t)
-            except:
-                self.checkdir(f)
+            except IOError:
+                os.makedirs(os.path.dirname(f))
                 file(f, "w").write(t)
 
         self.setcurrent(node)
         self.dircache.clear()
-        self.dircache.update(l)
+        self.dircache.update([f for f,n in l])
 
     def diffdir(self, path, changeset):
         changed = []