Package duplicity :: Module patchdir
[hide private]
[frames] | no frames]

Module patchdir

source code

Classes [hide private]
  PatchDirException
  Multivol_Filelike
Emulate a file like object from multivols
  PathPatcher
Used by DirPatch, process the given basis and diff
  TarFile_FromFileobjs
Like a tarfile.TarFile iterator, but read from multiple fileobjs
  IndexedTuple
Like a tuple, but has .index (used previously by collate_iters)
  ROPath_IterWriter
Used in Write_ROPaths above
Functions [hide private]
 
Patch(base_path, difftar_fileobj)
Patch given base_path and file object containing delta
source code
 
Patch_from_iter(base_path, fileobj_iter, restrict_index=())
Patch given base_path and iterator of delta file objects
source code
 
patch_diff_tarfile(base_path, diff_tarfile, restrict_index=())
Patch given Path object using delta tarfile (as in tarfile.TarFile)
source code
 
empty_iter() source code
 
filter_path_iter(path_iter, index)
Rewrite path elements of path_iter so they start with index
source code
 
difftar2path_iter(diff_tarfile)
Turn file-like difftarobj into iterator of ROPaths
source code
 
get_index_from_tarinfo(tarinfo)
Return (index, difftype, multivol) pair from tarinfo object
source code
 
collate_iters(iter_list)
Collate iterators by index
source code
 
normalize_ps(patch_sequence)
Given an sequence of ROPath deltas, remove blank and unnecessary
source code
 
patch_seq2ropath(patch_seq)
Apply the patches in patch_seq, return single ropath
source code
 
integrate_patch_iters(iter_list)
Combine a list of iterators of ropath patches
source code
 
tarfiles2rop_iter(tarfile_list, restrict_index=())
Integrate tarfiles of diffs into single ROPath iter
source code
 
Write_ROPaths(base_path, rop_iter)
Write out ropaths in rop_iter starting at base_path
source code
Function Details [hide private]

patch_diff_tarfile(base_path, diff_tarfile, restrict_index=())

source code 

Patch given Path object using delta tarfile (as in tarfile.TarFile)

If restrict_index is set, ignore any deltas in diff_tarfile that don't start with restrict_index.

filter_path_iter(path_iter, index)

source code 

Rewrite path elements of path_iter so they start with index

Discard any that doesn't start with index, and remove the index prefix from the rest.

collate_iters(iter_list)

source code 

Collate iterators by index

Input is a list of n iterators each of which must iterate elements with an index attribute. The elements must come out in increasing order, and the index should be a tuple itself.

The output is an iterator which yields tuples where all elements in the tuple have the same index, and the tuple has n elements in it. If any iterator lacks an element with that index, the tuple will have None in that spot.

normalize_ps(patch_sequence)

source code 

Given an sequence of ROPath deltas, remove blank and unnecessary

The sequence is assumed to be in patch order (later patches apply to earlier ones). A patch is unnecessary if a later one doesn't require it (for instance, any patches before a "delete" are unnecessary).

integrate_patch_iters(iter_list)

source code 

Combine a list of iterators of ropath patches

The iter_list should be sorted in patch order, and the elements in each iter_list need to be orderd by index. The output will be an iterator of the final ROPaths in index order.

tarfiles2rop_iter(tarfile_list, restrict_index=())

source code 

Integrate tarfiles of diffs into single ROPath iter

Then filter out all the diffs in that index which don't start with the restrict_index.

Write_ROPaths(base_path, rop_iter)

source code 

Write out ropaths in rop_iter starting at base_path

Returns 1 if something was actually written, 0 otherwise.