##// END OF EJS Templates
treemanifest: add treemanifest._isempty()...
Drew Gottlieb -
r24551:4fdf5eac default
parent child Browse files
Show More
@@ -370,6 +370,10 b' class treemanifest(object):'
370 size += m.__len__()
370 size += m.__len__()
371 return size
371 return size
372
372
373 def _isempty(self):
374 return (not self._files and (not self._dirs or
375 util.all(m._isempty() for m in self._dirs.values())))
376
373 def __str__(self):
377 def __str__(self):
374 return '<treemanifest dir=%s>' % self._dir
378 return '<treemanifest dir=%s>' % self._dir
375
379
@@ -445,7 +449,7 b' class treemanifest(object):'
445 if dir:
449 if dir:
446 self._dirs[dir].__delitem__(subpath)
450 self._dirs[dir].__delitem__(subpath)
447 # If the directory is now empty, remove it
451 # If the directory is now empty, remove it
448 if not self._dirs[dir]._dirs and not self._dirs[dir]._files:
452 if self._dirs[dir]._isempty():
449 del self._dirs[dir]
453 del self._dirs[dir]
450 else:
454 else:
451 del self._files[f]
455 del self._files[f]
General Comments 0
You need to be logged in to leave comments. Login now