Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove git caching

  • Loading branch information...
commit e7369596a5aa213c67fff974091dd579fbf33be8 1 parent e220223
@mwilliamson authored
Showing with 2 additions and 28 deletions.
  1. +2 −28 mayo/git.py
View
30 mayo/git.py
@@ -10,40 +10,14 @@ class Git(object):
name = "git"
directory_name = ".git"
default_branch = "origin/master"
- supports_caching = True
-
- def __init__(self, use_cache=False):
- self._use_cache = use_cache
-
- def use_cache(self):
- return Git(use_cache=True)
def clone(self, repository_uri, local_path):
- if self._use_cache:
- cache_dir = self._update_cache(repository_uri)
- _git(["clone", repository_uri, local_path, "--reference", cache_dir])
- _git(["repack", "-a"], cwd=local_path)
- _git(["submodule", "foreach", "git", "repack", "-a"], cwd=local_path)
-
- os.remove(os.path.join(local_path, ".git/objects/info/alternates"))
- else:
- _git(["clone", repository_uri, local_path])
+ _git(["clone", repository_uri, local_path])
return GitRepository(local_path)
def local_repo(self, working_directory):
return GitRepository(working_directory)
-
- def _update_cache(self, repository_uri):
- cache_root = mayo.caching.cache_root()
- repo_hash = hashlib.sha1(repository_uri).hexdigest()
- cache_dir = os.path.join(cache_root, repo_hash)
-
- if os.path.exists(cache_dir):
- _git(["fetch"], cwd=cache_dir)
- else:
- _git(["clone", repository_uri, cache_dir])
-
- return cache_dir
+
class GitRepository(object):
type = Git.name
Please sign in to comment.
Something went wrong with that request. Please try again.