summaryrefslogtreecommitdiff
path: root/rdiff-backup/rdiff_backup
diff options
context:
space:
mode:
authorbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-12-14 06:39:31 +0000
committerbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-12-14 06:39:31 +0000
commit16ea5b0ce7190fc368e07e61e7163c76deede4b1 (patch)
tree0de463197c03cdc232516d17b5aeade5eae30c77 /rdiff-backup/rdiff_backup
parent536a293b67ad8c1466cf4cd3c63fbf84406cf552 (diff)
downloadrdiff-backup-16ea5b0ce7190fc368e07e61e7163c76deede4b1.tar.gz
Write mirror metadata when incrementing
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@247 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/rdiff_backup')
-rw-r--r--rdiff-backup/rdiff_backup/Globals.py1
-rw-r--r--rdiff-backup/rdiff_backup/highlevel.py32
-rw-r--r--rdiff-backup/rdiff_backup/metadata.py12
3 files changed, 31 insertions, 14 deletions
diff --git a/rdiff-backup/rdiff_backup/Globals.py b/rdiff-backup/rdiff_backup/Globals.py
index 49d84db..61991d4 100644
--- a/rdiff-backup/rdiff_backup/Globals.py
+++ b/rdiff-backup/rdiff_backup/Globals.py
@@ -284,4 +284,5 @@ def set_select(dsrpath, tuplelist, quote_mode, *filelists):
from rpath import * # kludge to avoid circularity - not needed in this module
+from log import * # another kludge
from selection import *
diff --git a/rdiff-backup/rdiff_backup/highlevel.py b/rdiff-backup/rdiff_backup/highlevel.py
index 3aa6491..48cb123 100644
--- a/rdiff-backup/rdiff_backup/highlevel.py
+++ b/rdiff-backup/rdiff_backup/highlevel.py
@@ -21,14 +21,6 @@
from __future__ import generators
from static import *
-from log import *
-from rpath import *
-from robust import *
-from increment import *
-from destructive_stepping import *
-from rorpiter import *
-import Globals, Hardlink, MiscStats
-
class SkipFileException(Exception):
"""Signal that the current file should be skipped but then continue
@@ -207,9 +199,21 @@ class HLDestinationStruct:
return generate_dissimilar()
def get_sigs(cls, baserp, src_init_iter):
- """Return signatures of all dissimilar files"""
+ """Return signatures of all dissimilar files
+
+ Also writes all metadata to the metadata file.
+
+ """
dest_iters1 = cls.split_initial_dsiter()
- dissimilars = cls.get_dissimilar(baserp, src_init_iter, dest_iters1)
+ def duplicate_with_write(src_init_iter):
+ """Return iterator but write metadata of what passes through"""
+ metadata.OpenMetadata()
+ for rorp in src_init_iter:
+ metadata.WriteMetadata(rorp)
+ yield rorp
+ metadata.CloseMetadata()
+ dup = duplicate_with_write(src_init_iter)
+ dissimilars = cls.get_dissimilar(baserp, dup, dest_iters1)
return RORPIter.Signatures(dissimilars)
def get_dsrp(cls, dest_rpath, index):
@@ -331,3 +335,11 @@ class HLDestinationStruct:
raise
MakeClass(HLDestinationStruct)
+
+from log import *
+from rpath import *
+from robust import *
+from increment import *
+from destructive_stepping import *
+from rorpiter import *
+import Globals, Hardlink, MiscStats, metadata
diff --git a/rdiff-backup/rdiff_backup/metadata.py b/rdiff-backup/rdiff_backup/metadata.py
index 50a7704..d8e7216 100644
--- a/rdiff-backup/rdiff_backup/metadata.py
+++ b/rdiff-backup/rdiff_backup/metadata.py
@@ -56,7 +56,7 @@ field names and values.
from __future__ import generators
import re, gzip
-from rdiff_backup import log, Globals, rpath, Time
+import log, Globals, rpath, Time
class ParsingError(Exception):
"""This is raised when bad or unparsable data is received"""
@@ -260,11 +260,13 @@ metadata_rp = None
metadata_fileobj = None
def OpenMetadata(rp = None, compress = 1):
"""Open the Metadata file for writing"""
- global metadata_filename, metadata_fileobj
+ global metadata_rp, metadata_fileobj
assert not metadata_fileobj, "Metadata file already open"
if rp: metadata_rp = rp
- else: metadata_rp = Globals.rbdir.append("mirror_metadata.%s.data.gz" %
- (Time.curtimestr,))
+ else:
+ if compress: filename_base = "mirror_metadata.%s.data.gz"
+ else: filename_base = "mirror_metadata.%s.data"
+ metadata_rp = Globals.rbdir.append(filename_base % (Time.curtimestr,))
metadata_fileobj = metadata_rp.open("wb", compress = compress)
def WriteMetadata(rorp):
@@ -307,3 +309,5 @@ def GetMetadata_at_time(rpdir, time, restrict_index = None, rplist = None):
if Time.stringtotime(rp.getinctime()) == time:
return GetMetadata(rp, restrict_index)
return None
+
+