summaryrefslogtreecommitdiff
path: root/morphlib
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-05-03 11:23:56 +0100
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-05-04 14:24:07 +0100
commit66327f8eb3cec93b53a3dcc948369ba48c9ad50a (patch)
tree1ed39c3f8269c3a06b4438ce9f65e37172c05ce1 /morphlib
parent73e46e9e284c88ddd9e984844f02ab98d635d8a9 (diff)
downloadmorph-66327f8eb3cec93b53a3dcc948369ba48c9ad50a.tar.gz
Relax CachedRepo.checkout requirement that ref is a sha1
Diffstat (limited to 'morphlib')
-rw-r--r--morphlib/cachedrepo.py8
-rw-r--r--morphlib/cachedrepo_tests.py5
2 files changed, 2 insertions, 11 deletions
diff --git a/morphlib/cachedrepo.py b/morphlib/cachedrepo.py
index 5dc7e55d..0f348196 100644
--- a/morphlib/cachedrepo.py
+++ b/morphlib/cachedrepo.py
@@ -135,10 +135,9 @@ class CachedRepo(object):
(filename, ref, self))
def checkout(self, ref, target_dir):
- '''Unpacks the repository in a directory and checks out a SHA1 ref.
+ '''Unpacks the repository in a directory and checks out a commit ref.
- Raises an UnresolvedNamedReferenceError if the specified ref is not
- a SHA1 ref. Raises a CheckoutDirectoryExistsError if the target
+ Raises a CheckoutDirectoryExistsError if the target
directory already exists. Raises an InvalidReferenceError if the
ref is not found in the repository. Raises a CheckoutError if
something else goes wrong while copying the repository or checking
@@ -146,9 +145,6 @@ class CachedRepo(object):
'''
- if not self.is_valid_sha1(ref):
- raise UnresolvedNamedReferenceError(self, ref)
-
if os.path.exists(target_dir):
raise CheckoutDirectoryExistsError(self, target_dir)
diff --git a/morphlib/cachedrepo_tests.py b/morphlib/cachedrepo_tests.py
index 72624f36..127a866b 100644
--- a/morphlib/cachedrepo_tests.py
+++ b/morphlib/cachedrepo_tests.py
@@ -152,11 +152,6 @@ class CachedRepoTests(unittest.TestCase):
'e28a23812eadf2fce6583b8819b9c5dbd36b9fb9',
self.tempdir.dirname)
- def test_fail_checkout_from_named_ref_which_is_not_allowed(self):
- self.assertRaises(cachedrepo.UnresolvedNamedReferenceError,
- self.repo.checkout, 'master',
- self.tempdir.join('checkout-from-named-ref'))
-
def test_fail_checkout_from_invalid_ref(self):
self.assertRaises(cachedrepo.InvalidReferenceError, self.repo.checkout,
'079bbfd447c8534e464ce5d40b80114c2022ebf4',