[Zodb-checkins] SVN: ZODB/branches/3.10/src/ Ensure that export/index files created by repozo share the same timestamp.
Tres Seaver
cvs-admin at zope.org
Wed May 2 16:31:57 UTC 2012
Log message for revision 125620:
Ensure that export/index files created by repozo share the same timestamp.
https://bugs.launchpad.net/zodb/+bug/993350
Changed:
U ZODB/branches/3.10/src/CHANGES.txt
U ZODB/branches/3.10/src/ZODB/scripts/repozo.py
-=-
Modified: ZODB/branches/3.10/src/CHANGES.txt
===================================================================
--- ZODB/branches/3.10/src/CHANGES.txt 2012-05-02 16:27:10 UTC (rev 125619)
+++ ZODB/branches/3.10/src/CHANGES.txt 2012-05-02 16:31:53 UTC (rev 125620)
@@ -8,6 +8,11 @@
Bugs Fixed
----------
+- Ensured that the export file and index file created by ``repozo`` share
+ the same timestamp.
+
+ https://bugs.launchpad.net/zodb/+bug/993350
+
- Pinned the ``transaction`` and ``manuel`` dependencies to Python 2.5-
compatible versions when installing under Python 2.5.
Modified: ZODB/branches/3.10/src/ZODB/scripts/repozo.py
===================================================================
--- ZODB/branches/3.10/src/ZODB/scripts/repozo.py 2012-05-02 16:27:10 UTC (rev 125619)
+++ ZODB/branches/3.10/src/ZODB/scripts/repozo.py 2012-05-02 16:31:53 UTC (rev 125620)
@@ -305,7 +305,10 @@
return bytesread, sum.hexdigest()
-def gen_filename(options, ext=None):
+def gen_filedate(options):
+ return getattr(options, 'test_now', time.gmtime()[:6])
+
+def gen_filename(options, ext=None, now=None):
if ext is None:
if options.full:
ext = '.fs'
@@ -314,7 +317,8 @@
if options.gzip:
ext += 'z'
# Hook for testing
- now = getattr(options, 'test_now', time.gmtime()[:6])
+ if now is None:
+ now = gen_filedate(options)
t = now + (ext,)
return '%04d-%02d-%02d-%02d-%02d-%02d%s' % t
@@ -330,7 +334,7 @@
def find_files(options):
when = options.date
if not when:
- when = gen_filename(options, '')
+ when = gen_filename(options, ext='')
log('looking for files between last full backup and %s...', when)
all = filter(is_data_file, os.listdir(options.repository))
all.sort()
@@ -429,7 +433,8 @@
def do_full_backup(options):
options.full = True
- dest = os.path.join(options.repository, gen_filename(options))
+ tnow = gen_filedate(options)
+ dest = os.path.join(options.repository, gen_filename(options, now=tnow))
if os.path.exists(dest):
raise WouldOverwriteFiles('Cannot overwrite existing file: %s' % dest)
# Find the file position of the last completed transaction.
@@ -442,7 +447,7 @@
pos = fs.getSize()
# Save the storage index into the repository
index_file = os.path.join(options.repository,
- gen_filename(options, '.index'))
+ gen_filename(options, '.index', tnow))
log('writing index')
fs._index.save(pos, index_file)
fs.close()
@@ -461,7 +466,8 @@
def do_incremental_backup(options, reposz, repofiles):
options.full = False
- dest = os.path.join(options.repository, gen_filename(options))
+ tnow = gen_filedate(options)
+ dest = os.path.join(options.repository, gen_filename(options, now=tnow))
if os.path.exists(dest):
raise WouldOverwriteFiles('Cannot overwrite existing file: %s' % dest)
# Find the file position of the last completed transaction.
@@ -474,7 +480,7 @@
pos = fs.getSize()
log('writing index')
index_file = os.path.join(options.repository,
- gen_filename(options, '.index'))
+ gen_filename(options, '.index', tnow))
fs._index.save(pos, index_file)
fs.close()
log('writing incremental: %s bytes to %s', pos-reposz, dest)
More information about the Zodb-checkins
mailing list