[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: |
Bud P . Bruegger |
Subject: |
Re: [rdiff-backup-users] More newby Qs: list of changed files, server-side diffs |
Date: |
Tue, 3 Dec 2002 19:52:18 +0100 |
Ben,
finally tried out your patch. Many thanks, works great.
I tried to modify it such that it shows the type of change: (new, modified,
deleted) -- but there is still some problem that I can't figure out.
My modified version of ListChangedSince in Main.py are attached below.
The problem is that I can't recognize deleted files. I would have expected
get_rids_recursive(...).inc_list to include increment files of type "snapshot".
But they don't seem to be listed. What am I doing wrong?
Also, something that I plastered over with an if statement but don't understand
is that for some rids in get_rids_recursive(...), rid.index seems empty.
best cheers
--bud
PS. Beware, the version below has spaces instead of tabs for indenting (the
standard
setting of my editor)...
============== Main.ListChangedSince ======================
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"
if (len(incList) == 0):
return "new file"
elif (incList[0].path[-11:-3] == 'snapshot'):
#print "*** DELETED seems to work"
return "deleted"
elif (incList[-1].path[-7:] == 'missing'):
#print "*** NEW it seems to work"
return "new file"
else:
#print "*** DELETED seems to work"
return "modified"
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:
filePath = "/".join(rid.index)
if filePath:
changeType = determineChangeType(rid.inc_list)
print "%-10s: %s" % (changeType, filePath)
- Re: [rdiff-backup-users] More newby Qs: list of changed files, server-side diffs,
Bud P . Bruegger <=