diff options
author | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2012-09-03 17:16:11 +0100 |
---|---|---|
committer | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2012-09-03 17:16:11 +0100 |
commit | af11b82dfb2baf7d868bb84b86ae8a769dad03f9 (patch) | |
tree | 77aea82e5bd0efc89c77ecfad581d09327c0b215 | |
parent | 0f1bba88f80a044131bbedfa1af4ceeb1fbf3c08 (diff) | |
parent | 8ebddf0a3234eebceadc6a4edef94b566625cfd3 (diff) | |
download | lorry-af11b82dfb2baf7d868bb84b86ae8a769dad03f9.tar.gz |
Merge branch 'master' of roadtrain.codethink.co.uk:baserock/lorry
-rwxr-xr-x | lorry | 15 | ||||
-rwxr-xr-x | tests/git-backup-on-error.script | 3 | ||||
-rw-r--r-- | tests/git-backup-on-error.stdout | 4 |
3 files changed, 11 insertions, 11 deletions
@@ -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 @@ -411,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): 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 |