* use None for filesize if can't read
* get_file_hashes: warn if we're ignoring directory
This commit is contained in:
+1
-1
@@ -375,7 +375,7 @@ class Builder:
|
|||||||
try: # broken links can cause problem
|
try: # broken links can cause problem
|
||||||
fsize = str(os.path.getsize(fpath))
|
fsize = str(os.path.getsize(fpath))
|
||||||
except OSError:
|
except OSError:
|
||||||
fsize = "0"
|
fsize = None
|
||||||
d[frpath] = FileInfo(frpath, ftype, fsize, fhash)
|
d[frpath] = FileInfo(frpath, ftype, fsize, fhash)
|
||||||
for (p, fileinfo) in d.iteritems():
|
for (p, fileinfo) in d.iteritems():
|
||||||
files.append(fileinfo)
|
files.append(fileinfo)
|
||||||
|
|||||||
@@ -67,8 +67,6 @@ class FileInfo:
|
|||||||
err = Checks()
|
err = Checks()
|
||||||
err.has_tag(self.path, "File", "Path")
|
err.has_tag(self.path, "File", "Path")
|
||||||
err.has_tag(self.type, "File", "Type")
|
err.has_tag(self.type, "File", "Type")
|
||||||
err.has_tag(self.size, "File", "Size")
|
|
||||||
#err.has_tag(self.hash, "File", "SHA1Sum")
|
|
||||||
return err.list
|
return err.list
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
|||||||
+4
-2
@@ -282,8 +282,10 @@ def get_file_hashes(top, exclude_prefix=None, removePrefix=None):
|
|||||||
except FileError, e:
|
except FileError, e:
|
||||||
if os.path.islink(f):
|
if os.path.islink(f):
|
||||||
ctx.ui.warning(_('Ignoring "external" link %s') % f)
|
ctx.ui.warning(_('Ignoring "external" link %s') % f)
|
||||||
# else:
|
elif os.path.isdir(f):
|
||||||
# raise e
|
ctx.ui.warning(_('Ignoring directory %s') % f)
|
||||||
|
else:
|
||||||
|
raise e
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# also handle single files
|
# also handle single files
|
||||||
|
|||||||
Reference in New Issue
Block a user