summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-08-31 15:53:52 +0100
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-08-31 15:53:52 +0100
commit8ebddf0a3234eebceadc6a4edef94b566625cfd3 (patch)
treeb0e47a7213abcdc6e59234f5b3e689a37088e98f
parent77a24e14c8e24654e72e8b840aeda15238033c5c (diff)
parent9c1609b241c48748dad26cf14dcad2374e392b55 (diff)
downloadlorry-8ebddf0a3234eebceadc6a4edef94b566625cfd3.tar.gz
Merge branch 'liw/names-with-slashes'
Reviewed-By: Daniel Silverstone on irc
-rwxr-xr-xlorry15
-rwxr-xr-xtests/git-backup-on-error.script3
-rw-r--r--tests/git-backup-on-error.stdout4
3 files changed, 11 insertions, 11 deletions
diff --git a/lorry b/lorry
index 6ddb9c3..1f0580a 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
@@ -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