# tarfile.extractall for details.
_directories = []
- def __init__(self, deltatar, cwd, index_list=[], backup_path=False,
+ def __init__(self, deltatar, cwd, index_list=None, backup_path=False,
tarobj=None):
'''
Constructor opens the tars and init the data structures.
- Index list must be provided in reverse order (newer first)
+ Assumptions:
+
+ - Index list must be provided in reverse order (newer first).
+ - “newer first” apparently means that if there are n backups
+ provided, the last full backup is at index n-1 and the most recent
+ diff backup is at index 0.
+ - Only the first, the second, and the last elements of
+ ``index_list`` are relevant, others will not be accessed.
+ - If no ``index_list`` is provided, both ``tarobj`` and
+ ``backup_path`` must be passed.
+ - If ``index_list`` is provided, the values of ``tarobj`` and
+ ``backup_path`` are ignored.
'''
self._data = []
self._directories = []
self._deltatar = deltatar
self._cwd = cwd
- self._index_list = index_list
try:
import grp, pwd
else:
self.canchown = False
- if index_list:
+ if index_list is not None:
for index in index_list:
- is_full = (index == index_list[-1])
+ is_full = index == index_list[-1]
# make paths absolute to avoid cwd problems
if not os.path.isabs(index):
Restore the path from the appropriate backup. Receives the current path
from the newest (=first) index iterator. itpath must be not null.
callback is a custom function that gets called for every file.
+
+ NB: This function takes the attribute ``_data`` as input but will only
+ ever use its first and, if available, second element. Anything else in
+ ``._data[]`` will be ignored.
'''
path = itpath['path']