19 |
|
|
20 |
"""Provides functions and *ITR classes, for writing increment files""" |
"""Provides functions and *ITR classes, for writing increment files""" |
21 |
|
|
22 |
import Globals, Time, rpath, Rdiff, log, statistics |
import Globals, Time, rpath, Rdiff, log, statistics, robust |
23 |
|
|
24 |
|
|
25 |
def Increment(new, mirror, incpref): |
def Increment(new, mirror, incpref): |
59 |
def makesnapshot(mirror, incpref): |
def makesnapshot(mirror, incpref): |
60 |
"""Copy mirror to incfile, since new is quite different""" |
"""Copy mirror to incfile, since new is quite different""" |
61 |
compress = iscompressed(mirror) |
compress = iscompressed(mirror) |
62 |
if compress: snapshotrp = get_inc(incpref, "snapshot.gz") |
if compress and mirror.isreg(): |
63 |
|
snapshotrp = get_inc(incpref, "snapshot.gz") |
64 |
else: snapshotrp = get_inc(incpref, "snapshot") |
else: snapshotrp = get_inc(incpref, "snapshot") |
65 |
rpath.copy_with_attribs(mirror, snapshotrp, compress) |
|
66 |
|
if mirror.isspecial(): # check for errors when creating special increments |
67 |
|
eh = robust.get_error_handler("SpecialFileError") |
68 |
|
if robust.check_common_error(eh, rpath.copy_with_attribs, |
69 |
|
(mirror, snapshotrp, compress)) == 0: |
70 |
|
snapshotrp.setdata() |
71 |
|
if snapshotrp.lstat(): snapshotrp.delete() |
72 |
|
snapshotrp.touch() |
73 |
|
else: rpath.copy_with_attribs(mirror, snapshotrp, compress) |
74 |
return snapshotrp |
return snapshotrp |
75 |
|
|
76 |
def makediff(new, mirror, incpref): |
def makediff(new, mirror, incpref): |