summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-05-11 23:28:20 +0000
committerben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-05-11 23:28:20 +0000
commit41d607d9cf3537481308cf98fcbb3517005afa39 (patch)
treeb45c13a9edff5b5eed8f927df7503deafe1dde9e
parentd1bb9d523ada295e675d153ce7eee646e246b7ff (diff)
downloadrdiff-backup-41d607d9cf3537481308cf98fcbb3517005afa39.tar.gz
Fixed bug in restore older than code.
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@82 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
-rwxr-xr-xrdiff-backup/src/main.py31
1 files changed, 18 insertions, 13 deletions
diff --git a/rdiff-backup/src/main.py b/rdiff-backup/src/main.py
index bb377a5..c130e56 100755
--- a/rdiff-backup/src/main.py
+++ b/rdiff-backup/src/main.py
@@ -440,25 +440,30 @@ Try restoring from an increment file (the filenames look like
def RemoveOlderThan(self, rootrp):
"""Remove all increment files older than a certain time"""
- datadir = self.li_getdatadir(rootrp,
- """Unable to open rdiff-backup-data dir.
+ datadir = rootrp.append("rdiff-backup-data")
+ if not datadir.lstat() or not datadir.isdir():
+ Log.FatalError("Unable to open rdiff-backup-data dir %s" %
+ (datadir.path,))
-Try finding the increments first using --list-increments.""")
try: time = Time.genstrtotime(self.remove_older_than_string)
except TimeError, exp: Log.FatalError(str(exp))
timep = Time.timetopretty(time)
Log("Deleting increment(s) before %s" % timep, 4)
- incobjs = filter(lambda x: x.time < time, Manage.get_incobjs(datadir))
- incobjs_time = ", ".join(map(IncObj.pretty_time, incobjs))
- if not incobjs:
- Log.FatalError("No increments older than %s found" % timep)
- elif len(incobjs) > 1 and not self.force:
- Log.FatalError("Found %d relevant increments, dated %s.\n"
- "If you want to delete multiple increments in this way, "
- "use the --force." % (len(incobjs), incobjs_time))
- Log("Deleting increment%sat %s" % (len(incobjs) == 1 and " " or "s ",
- incobjs_time), 3)
+ itimes = [Time.stringtopretty(inc.getinctime())
+ for inc in Restore.get_inclist(datadir.append("increments"))
+ if Time.stringtotime(inc.getinctime()) < time]
+
+ if not itimes:
+ Log.FatalError("No increments older than %s found" % timep)
+ inc_pretty_time = "\n".join(itimes)
+ if len(itimes) > 1 and not self.force:
+ Log.FatalError("Found %d relevant increments, dated:\n%s"
+ "\nIf you want to delete multiple increments in this way, "
+ "use the --force." % (len(itimes), inc_pretty_time))
+
+ Log("Deleting increment%sat times:\n%s" %
+ (len(itimes) == 1 and " " or "s ", inc_pretty_time), 3)
Manage.delete_earlier_than(datadir, time)