Mercurial > hg > fetch
comparison fetch.py @ 27:423b67ff4512
more stubbing
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Mon, 14 Nov 2011 21:32:54 -0800 |
parents | d495b610046a |
children | 5ecb6507931b |
comparison
equal
deleted
inserted
replaced
26:d495b610046a | 27:423b67ff4512 |
---|---|
148 if os.path.isdir(path): | 148 if os.path.isdir(path): |
149 if os.path.exists(dest): | 149 if os.path.exists(dest): |
150 assert os.path.isdir(dest), "source is a directory; destination is a file" | 150 assert os.path.isdir(dest), "source is a directory; destination is a file" |
151 else: | 151 else: |
152 os.makedirs(dest) | 152 os.makedirs(dest) |
153 shutil.copytree(path, dest) | |
153 else: | 154 else: |
154 if os.path.exists(dest): | 155 if not os.path.exists(dest): |
155 assert os.path.isfile(dest), "" | |
156 else: | |
157 directory, filename = os.path.split(dest) | 156 directory, filename = os.path.split(dest) |
157 if os.path.exists(directory): | |
158 assert os.path.isdir(directory), "%s is not a directory" % directory | |
159 else: | |
160 os.makedirs(directory) | |
161 shutil.copy(path, dest) | |
158 shutil.rmtree(tmpdir) | 162 shutil.rmtree(tmpdir) |
159 | 163 |
160 def clone(self, dest): | 164 def clone(self, dest): |
161 """ | 165 """ |
162 clones into a directory | 166 clones into a directory |