From 366f79fe42632336f223110eb95057586672dc3e Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Fri, 31 Aug 2012 15:33:15 +0100 Subject: Improve reporting of exceptions during mirroring --- lorry | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lorry b/lorry index 6ddb9c3..cbd41ae 100755 --- a/lorry +++ b/lorry @@ -24,6 +24,7 @@ import string import sys from datetime import datetime import shutil +import traceback __version__ = '0.0' @@ -92,13 +93,14 @@ class Lorry(cliapp.Application): with open(arg) as f: specs = json.load(f) for name in sorted(specs.keys()): - try: - self.progress('Getting: %s' % name) + self.progress('Getting: %s' % name) + try: self.gitify(name, specs[name]) - except Exception,e: + except Exception,e: status += 1 - print 'Exception:',e - logging.debug('Mirroring Error: %s' %e) + sys.stderr.write( + 'Error mirroring:\n%s' % traceback.format_exc()) + logging.error(traceback.format_exc()) if status > 0 : logging.debug('Total Mirrors failed: %d' %status) status = 1 -- cgit v1.2.1 From 4a951edc804d8034151cbc65bbcac850c794391a Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Fri, 31 Aug 2012 15:35:57 +0100 Subject: Allow slashes in project names --- lorry | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lorry b/lorry index cbd41ae..1f0580a 100755 --- a/lorry +++ b/lorry @@ -413,8 +413,9 @@ class Lorry(cliapp.Application): return ''.join(' %s\n' % line for line in string.splitlines()) def dirname(self, project_name): - assert '/' not in project_name assert '\0' not in project_name + # We escape slashes as underscores. + project_name = '_'.join(project_name.split('/')) return os.path.join(self.settings['working-area'], project_name) def progress(self, msg): -- cgit v1.2.1 From 9c1609b241c48748dad26cf14dcad2374e392b55 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Fri, 31 Aug 2012 15:39:24 +0100 Subject: Fix test case after message changes --- tests/git-backup-on-error.script | 3 ++- tests/git-backup-on-error.stdout | 4 ---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/git-backup-on-error.script b/tests/git-backup-on-error.script index cbaa247..134367c 100755 --- a/tests/git-backup-on-error.script +++ b/tests/git-backup-on-error.script @@ -40,7 +40,8 @@ normalize() { # make upstream disappear to cause errors rm -rf "$repo" if ./lorry --pull-only --log="$logfile" --working-area="$workdir" \ - "$DATADIR/git-backup-test-repo.lorry" --bundle=never | normalize + "$DATADIR/git-backup-test-repo.lorry" --bundle=never 2>/dev/null | \ + normalize then echo Previous lorry command should have failed >&2 exit 1 diff --git a/tests/git-backup-on-error.stdout b/tests/git-backup-on-error.stdout index bdee3e0..195970e 100644 --- a/tests/git-backup-on-error.stdout +++ b/tests/git-backup-on-error.stdout @@ -1,8 +1,4 @@ Mirror of git-backup-test-repo failed, state before mirror is saved at DATADIR/work-dir/git-backup-test-repo/git-pre-update-DATETIME and state after mirror is saved at DATADIR/work-dir/git-backup-test-repo/git-post-fail-DATETIME -Exception: git fetch file://DATADIR/git-backup-test-repo +refs/heads/*:refs/heads/* +refs/tags/*:refs/tags/* failed (exit code 128): - fatal: 'DATADIR/git-backup-test-repo' does not appear to be a git repository - fatal: The remote end hung up unexpectedly - DATADIR/work-dir/git-backup-test-repo DATADIR/work-dir/git-backup-test-repo/git DATADIR/work-dir/git-backup-test-repo/git-post-fail-DATETIME -- cgit v1.2.1