summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam@afuera.me.uk>2014-06-14 19:06:42 +0100
committerSam Thursfield <sam@afuera.me.uk>2014-08-29 15:15:57 +0000
commit5e2a58f87ed1bfa82796a2b9191b4341913901c4 (patch)
tree10eccbf6427ba2da94bb6e0e12079e3400b6a649
parentc29b33ca89893c8baee838577ea22e13b97f26c7 (diff)
downloadmorph-5e2a58f87ed1bfa82796a2b9191b4341913901c4.tar.gz
Raise exception if a ref is not valid in the remote repo cache
Previously if a ref didn't resolve in the remote cache, we'd clone the repo into the local cache and check again. However, 99% of the time the clone comes from the remote cache so we should be able to assume that if the ref doesn't exist there, it doesn't exist at all.
-rw-r--r--morphlib/app.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/morphlib/app.py b/morphlib/app.py
index 7899ae29..43567360 100644
--- a/morphlib/app.py
+++ b/morphlib/app.py
@@ -21,6 +21,7 @@ import os
import re
import sys
import time
+import urllib2
import urlparse
import warnings
import extensions
@@ -331,13 +332,12 @@ class Morph(cliapp.Application):
elif rrc is not None:
try:
absref, tree = rrc.resolve_ref(reponame, ref)
- if absref is not None:
- self.status(msg='Resolved %(reponame)s %(ref)s via remote '
- 'repo cache',
- reponame=reponame,
- ref=ref,
- chatty=True)
- except BaseException, e:
+ self.status(msg='Resolved %(reponame)s %(ref)s via remote '
+ 'repo cache',
+ reponame=reponame,
+ ref=ref,
+ chatty=True)
+ except urllib2.URLError as e:
logging.warning('Caught (and ignored) exception: %s' % str(e))
if absref is None:
if update: