diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-05-03 13:48:08 +0100 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-05-04 14:24:07 +0100 |
commit | 34cec56598a84571f93573447a8e7ce941d0b293 (patch) | |
tree | 7f4b502f68852576620b5627a0d0bed1b002cdf1 /morphlib/cachedrepo.py | |
parent | 66327f8eb3cec93b53a3dcc948369ba48c9ad50a (diff) | |
download | morph-34cec56598a84571f93573447a8e7ce941d0b293.tar.gz |
Make morph's _clone_to_directory use CachedRepo.checkout
This requires changing CachedRepo.checkout to handle non-sha1 refs,
which resulted in some further changes in tests and their expected
outputs.
Also, a fix to CachedRepo to use the cwd keyword argument instead
of pwd.
Diffstat (limited to 'morphlib/cachedrepo.py')
-rw-r--r-- | morphlib/cachedrepo.py | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/morphlib/cachedrepo.py b/morphlib/cachedrepo.py index 0f348196..7d2bae4b 100644 --- a/morphlib/cachedrepo.py +++ b/morphlib/cachedrepo.py @@ -149,15 +149,10 @@ class CachedRepo(object): raise CheckoutDirectoryExistsError(self, target_dir) os.mkdir(target_dir) - - try: - sha1 = self._rev_list(ref).strip() - except morphlib.execute.CommandFailure: - raise InvalidReferenceError(self, ref) try: self._copy_repository(self.path, target_dir) - self._checkout_ref(sha1, target_dir) + self._checkout_ref(ref, target_dir) except morphlib.execute.CommandFailure: raise CheckoutError(self, ref, target_dir) @@ -189,7 +184,7 @@ class CachedRepo(object): target_dir]) def _checkout_ref(self, ref, target_dir): # pragma: no cover - self.ex.runv(['git', 'checkout', ref], pwd=target_dir) + self.ex.runv(['git', 'checkout', ref], cwd=target_dir) def _update(self): # pragma: no cover self.ex.runv(['git', 'remote', 'update', 'origin']) |