summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2003-09-25 18:13:26 +0000
committerbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2003-09-25 18:13:26 +0000
commit226e2eef9b8caa629ce8155d575125667a5d2cf6 (patch)
treeca7a0717ca964c3215552b3edbfdbb72f04e468f
parent0f86dd2fe9bbcef2ca14c423ed4f9d77ad644ca4 (diff)
downloadrdiff-backup-226e2eef9b8caa629ce8155d575125667a5d2cf6.tar.gz
Possibly fixed logic error in rf caching
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@454 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
-rw-r--r--rdiff-backup/rdiff_backup/restore.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/rdiff-backup/rdiff_backup/restore.py b/rdiff-backup/rdiff_backup/restore.py
index 341e518..2e8bf35 100644
--- a/rdiff-backup/rdiff_backup/restore.py
+++ b/rdiff-backup/rdiff_backup/restore.py
@@ -308,11 +308,15 @@ class CachedRF:
while 1:
if not self.rf_list:
if not self.add_rfs(index): return None
- rf = self.rf_list.pop(0)
- if rf.index < index: continue
- elif rf.index == index: return rf
- self.rf_list.insert(0, rf)
- if not self.add_rfs(index): return None
+ rf = self.rf_list[0]
+ if rf.index == index: return rf
+ elif rf.index > index:
+ # Try to add earlier indicies. But if first is
+ # already from same directory, or we can't find any
+ # from that directory, then we know it can't be added.
+ if (index[:-1] == rf.index[:-1] or not
+ self.add_rfs(index)): return None
+ else: del self.rf_list[0]
def get_fp(self, index):
"""Return the file object (for reading) of given index"""