diff fetch.py @ 23:12ad9ab11860

stubbing
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 09 Nov 2011 20:21:14 -0800
parents 0706968f01bb
children b1f65f3bd1bc
line wrap: on
line diff
--- a/fetch.py	Wed Nov 09 20:11:05 2011 -0800
+++ b/fetch.py	Wed Nov 09 20:21:14 2011 -0800
@@ -5,6 +5,7 @@
 """
 
 import os
+import shutil
 import sys
 import optparse
 
@@ -24,12 +25,12 @@
     def match(cls, _type):
         return _type == cls.type
 
-    def __init__(self, url, clobber=False):
+    def __init__(self, url, clobber=True):
         self.subpath = None
         if '#' in url:
             url, self.subpath = url.rsplit('#')
         self.url = url
-        # self.clobber = clobber # unused
+        self.clobber = clobber 
 
     def __call__(self, dest):
         raise NotImplementedError("Should be called by implementing class")
@@ -108,13 +109,14 @@
             self.hg = which('hg')
 
         def __call__(self, dest):
-            if os.path.exits(dest):
+            if os.path.exists(dest):
                 assert os.path.isdir(dest) and os.path.exists(os.path.join(dest, '.hg'))
                 call([self.hg, 'pull', self.url], cwd=dest)
                 call([self.hg, 'update'], cwd=dest)
             else:
-                pass
-            raise NotImplementedError("TODO! Sorry!")
+                if not os.path.exists(dest):
+                    os.mkdirs(dest)
+                call([self.hg, 'clone', self.url, dest])
 
     fetchers.append(HgFetcher)
 
@@ -126,7 +128,9 @@
 
         def __init__(self, url, export=True):
             VCSFetcher.__init__(self, url, export=True)
-            self.hg = which('git')
+            self.git = which('git')
+
+        def __call__(self, url
 
     fetchers.append(GitFetcher)