summaryrefslogtreecommitdiff
path: root/morphlib/plugins/get_repo_plugin.py
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2016-03-03 15:56:40 +0000
committerSam Thursfield <sam.thursfield@codethink.co.uk>2016-03-03 17:11:25 +0000
commit014a029ade9a045a839ca86c35690b218098ea33 (patch)
tree4806d6cc1f0572604a4d027bf7a7141e381f85d6 /morphlib/plugins/get_repo_plugin.py
parente8a67a7d12d2defbf975d707e7513837403d93a2 (diff)
downloadmorph-014a029ade9a045a839ca86c35690b218098ea33.tar.gz
Get rid of the CachedRepo class (almost)
For a long time the CachedRepo class has basically been a wrapper around the GitDir class, but with a few extra methods that don't really even belong there. It is now a tiny class in the localrepocache module which just keeps track of a few extra attributes. All other functionality is provided by the gitdir module. This commit also removes the `git clone` approach for copying repos out of the cache. The alternative approach implemented by git.copy_repository() was slightly faster when I tested, so for now we should use that everywhere. Longer term we should find out why this is quicker than `git clone`, and fix Git itself to be fast. Change-Id: I1686ab43253d44c3903d9a0bad8bb75528e9cf75
Diffstat (limited to 'morphlib/plugins/get_repo_plugin.py')
-rw-r--r--morphlib/plugins/get_repo_plugin.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/morphlib/plugins/get_repo_plugin.py b/morphlib/plugins/get_repo_plugin.py
index e8ebf229..fc81d6e5 100644
--- a/morphlib/plugins/get_repo_plugin.py
+++ b/morphlib/plugins/get_repo_plugin.py
@@ -46,13 +46,13 @@ class GetRepoPlugin(cliapp.Plugin):
def _clone_repo(self, cached_repo, dirname, checkout_ref):
'''Clone a cached git repository into the directory given by path.'''
# Do the clone.
- gd = morphlib.gitdir.clone_from_cached_repo(
- cached_repo, dirname, checkout_ref)
+ gd = morphlib.gitdir.checkout_from_cached_repo(
+ cached_repo, checkout_ref, dirname)
# Configure the "origin" remote to use the upstream git repository,
# and not the locally cached copy.
resolver = morphlib.repoaliasresolver.RepoAliasResolver(
- cached_repo.app.settings['repo-alias'])
+ self.app.settings['repo-alias'])
remote = gd.get_remote('origin')
remote.set_fetch_url(resolver.pull_url(cached_repo.url))
remote.set_push_url(resolver.push_url(cached_repo.original_name))