From ef79a33ae64761de55f8d12f50356226d36ebe18 Mon Sep 17 00:00:00 2001 From: bescoto Date: Mon, 3 Mar 2003 01:37:10 +0000 Subject: Fixed --print-statistics and spurious server error message git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@290 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109 --- rdiff-backup/CHANGELOG | 15 +++++++++++---- rdiff-backup/rdiff_backup/Main.py | 1 + rdiff-backup/rdiff_backup/backup.py | 3 ++- rdiff-backup/rdiff_backup/rorpiter.py | 2 +- rdiff-backup/rdiff_backup/statistics.py | 10 +++++++++- 5 files changed, 24 insertions(+), 7 deletions(-) diff --git a/rdiff-backup/CHANGELOG b/rdiff-backup/CHANGELOG index 4c261fa..2c83469 100644 --- a/rdiff-backup/CHANGELOG +++ b/rdiff-backup/CHANGELOG @@ -1,11 +1,18 @@ New in v0.11.3 (2003/04/01) --------------------------- -Brought some old parts of the man page up-to-date (thanks to Olivier -Mueller). +Fixed a number of bugs reported by Olivier Mueller: + + Brought some old parts of the man page up-to-date. + + Fixed bug if unrecoverable error on second backup to a directory. + + Fixed spurious error message that could appear after a successful + backup. + + --print-statistics option works again (before it would silently + ignored). -Fixed bug if unrecoverable error on second backup to a directory (also -repored Olivier Mueller). New in v0.11.2 (2003/03/01) diff --git a/rdiff-backup/rdiff_backup/Main.py b/rdiff-backup/rdiff_backup/Main.py index 930b6c6..5f6cbbc 100644 --- a/rdiff-backup/rdiff_backup/Main.py +++ b/rdiff-backup/rdiff_backup/Main.py @@ -204,6 +204,7 @@ def take_action(rps): """Do whatever action says""" if action == "server": connection.PipeConnection(sys.stdin, sys.stdout).Server() + sys.exit(0) elif action == "backup": Backup(rps[0], rps[1]) elif action == "restore": Restore(*rps) elif action == "restore-as-of": RestoreAsOf(rps[0], rps[1]) diff --git a/rdiff-backup/rdiff_backup/backup.py b/rdiff-backup/rdiff_backup/backup.py index 9e24e56..0ee782c 100644 --- a/rdiff-backup/rdiff_backup/backup.py +++ b/rdiff-backup/rdiff_backup/backup.py @@ -154,7 +154,7 @@ class DestinationStruct: Hardlink.islinked(src_rorp or dest_rorp)): dest_sig = rpath.RORPath(index) dest_sig.flaglinked(Hardlink.get_link_index(dest_sig)) - elif dest_rorp: + elif dest_rorp: dest_sig = dest_rorp.getRORPath() if dest_rorp.isreg(): dest_rp = dest_base_rpath.new_index(index) @@ -311,6 +311,7 @@ class CacheCollatedPostProcess: """Process the remaining elements in the cache""" while self.cache_indicies: self.shorten_cache() metadata.CloseMetadata() + if Globals.print_statistics: statistics.print_active_stats() statistics.write_active_statfileobj() diff --git a/rdiff-backup/rdiff_backup/rorpiter.py b/rdiff-backup/rdiff_backup/rorpiter.py index ee4a7ed..fda06e5 100644 --- a/rdiff-backup/rdiff_backup/rorpiter.py +++ b/rdiff-backup/rdiff_backup/rorpiter.py @@ -393,5 +393,5 @@ class CacheIndexable: try: return self.cache_dict[index] except KeyError: assert index >= self.cache_indicies[0], \ - repr((index, self.cache_indicies[0])) + "Index out of order: "+repr((index, self.cache_indicies[0])) return None diff --git a/rdiff-backup/rdiff_backup/statistics.py b/rdiff-backup/rdiff_backup/statistics.py index 6356101..5ed6cd3 100644 --- a/rdiff-backup/rdiff_backup/statistics.py +++ b/rdiff-backup/rdiff_backup/statistics.py @@ -20,7 +20,7 @@ """Generate and process aggregated backup information""" import re, os, time -import Globals, robust, Time, rorpiter, increment +import Globals, robust, Time, rorpiter, increment, log class StatsException(Exception): pass @@ -342,3 +342,11 @@ def write_active_statfileobj(): _active_statfileobj.finish() _active_statfileobj.write_stats_to_rp(session_stats_rp) _active_statfileobj = None + +def print_active_stats(): + """Print statistics of active statobj to stdout and log""" + global _active_statfileobj + assert _active_statfileobj + statmsg = _active_statfileobj.get_stats_logstring("Session statistics") + log.Log.log_to_file(statmsg) + Globals.client_conn.sys.stdout.write(statmsg) -- cgit v1.2.1