[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [rdiff-backup-users] More newby Qs: list of changed files, server-si
From: |
Ben Escoto |
Subject: |
Re: [rdiff-backup-users] More newby Qs: list of changed files, server-side diffs |
Date: |
Fri, 13 Dec 2002 17:16:58 -0800 |
>>>>> "BB" == Bud P Bruegger <address@hidden>
>>>>> wrote the following on Tue, 3 Dec 2002 19:52:18 +0100
BB> I tried to modify it such that it shows the type of change:
BB> (new, modified, deleted) -- but there is still some problem that
BB> I can't figure out.
BB> My modified version of ListChangedSince in Main.py are attached
BB> below.
BB> The problem is that I can't recognize deleted files. I would
BB> have expected get_rids_recursive(...).inc_list to include
BB> increment files of type "snapshot". But they don't seem to be
BB> listed. What am I doing wrong?
Hi, sorry for the delay. Your patch looks good; I committed it to CVS
with some modifications (new version below). However, it is
impossible from just looking at the increments, to tell whether a file
was deleted. Suppose a regular file is deleted, or suppose it gets
replaced by a symlink. Or suppose the permissions on a device file
get changed. All of these result in a snapshot, so we can't tell what
happened by noting the fact that there is a snapshot. If you want
this information, you could try using RestoreCombinedData objects
instead of RestoreIncrementData.
BB> Also, something that I plastered over with an if statement but
BB> don't understand is that for some rids in
BB> get_rids_recursive(...), rid.index seems empty.
rid.index can be the empty tuple () when processing the root, but it
should never be None.
BB> PS. Beware, the version below has spaces instead of tabs for
BB> indenting (the standard setting of my editor)...
Maybe spaces are more standard. This all started when I couldn't
figure out how to tell XEmacs's python mode to indent with 4 spaces.
Maybe I should try to figure that out again and then switch. Tabs
still seem more logical to me though.
--
Ben Escoto
def ListChangedSince(rp):
"""List all the files under rp that have changed since restoretime"""
try: rest_time = Time.genstrtotime(restore_timestr)
except Time.TimeException, exc: Log.FatalError(str(exc))
mirror_root, index = restore_get_root(rp)
Globals.rbdir = datadir = mirror_root.append_path("rdiff-backup-data")
mirror_time = Restore.get_mirror_time()
def get_rids_recursive(rid):
"""Yield all the rids under rid that have inc newer than
rest_time"""
yield rid
for sub_rid in Restore.yield_rids(rid, rest_time, mirror_time):
for sub_sub_rid in get_rids_recursive(sub_rid): yield
sub_sub_rid
def determineChangeType(incList):
"returns the type of change determined from incList"
assert len(incList) > 0
last_inc_type = incList[-1].getinctype() # examine earliest
change
if last_inc_type == 'snapshot': return "misc change"
elif last_inc_type == 'missing': return "new file"
elif last_inc_type == 'diff': return "modified"
elif last_inc_type == 'dir': return "dir change"
else: return "Unknown!"
inc_rpath = datadir.append_path('increments', index)
inc_list = Restore.get_inclist(inc_rpath)
root_rid = RestoreIncrementData(index, inc_rpath, inc_list)
for rid in get_rids_recursive(root_rid):
if rid.inc_list:
if not rid.index: path = "."
else: path = "/".join(rid.index)
print "%-11s: %s" % (determineChangeType(rid.inc_list),
path)
pgpC_NUjFR9tG.pgp
Description: PGP signature