* don't fail if two files are the same

This commit is contained in:
Eray Özkural
2006-05-30 08:04:54 +00:00
parent 7588016165
commit db02e58fdd
+4 -2
View File
@@ -106,8 +106,10 @@ class File:
ctx.ui.info(_("Fetching %s") % uri.get_uri()) ctx.ui.info(_("Fetching %s") % uri.get_uri())
fetch_url(uri, transfer_dir) fetch_url(uri, transfer_dir)
else: else:
ctx.ui.info(_("Copying %s to transfer dir") % uri.get_uri()) # copy to transfer dir, it's okay if transfer_dir is the same
shutil.copy(uri.get_uri(), transfer_dir) if not os.path.samefile(uri.get_uri(), join(transfer_dir, uri.filename())):
ctx.ui.info(_("Copying %s to transfer dir") % uri.get_uri())
shutil.copy(uri.get_uri(), transfer_dir)
else: else:
localfile = uri.get_uri() #TODO: use a special function here? localfile = uri.get_uri() #TODO: use a special function here?
if not os.path.exists(localfile): if not os.path.exists(localfile):