Permalink
Browse files

Remove archive caching

  • Loading branch information...
1 parent e736959 commit d9235e35fcca75c102dfc3956300a0e6e3ed55bb @mwilliamson committed Mar 18, 2013
Showing with 7 additions and 33 deletions.
  1. +0 −6 mayo/caching.py
  2. +5 −12 mayo/fetcher.py
  3. +0 −1 mayo/git.py
  4. +2 −14 tests/fetcher_tests.py
View
@@ -1,6 +0,0 @@
-import os
-
-
-def cache_root():
- xdg_cache_home = os.environ.get("XDG_CACHE_HOME", os.path.expanduser("~/.cache"))
- return os.environ.get("MAYO_CACHE_DIR", os.path.join(xdg_cache_home, "mayo"))
View
@@ -7,21 +7,14 @@
import mayo.systems
import mayo.uri_parser
import mayo.errors
-import mayo.caching
+
def archive(uri_str, local_path):
uri_hash = _sha1(uri_str)
- cacher = catchy.DirectoryCacher(os.path.join(mayo.caching.cache_root(), "archive"))
- cache_result = cacher.fetch(uri_hash, local_path)
- if not cache_result.cache_hit:
- uri = mayo.uri_parser.parse(uri_str)
-
- vcs, local_repo = _fetch(uri_str, local_path)
- is_fixed_revision = local_repo.is_fixed_revision(uri.revision)
- shutil.rmtree(os.path.join(local_path, vcs.directory_name))
-
- if is_fixed_revision:
- cacher.put(uri_hash, local_path)
+ uri = mayo.uri_parser.parse(uri_str)
+
+ vcs, local_repo = _fetch(uri_str, local_path)
+ shutil.rmtree(os.path.join(local_path, vcs.directory_name))
def _sha1(value):
return hashlib.sha1(value).hexdigest()
View
@@ -3,7 +3,6 @@
import hashlib
from .util import run
-import mayo.caching
class Git(object):
@@ -161,20 +161,8 @@ def can_use_cache_when_cloning_git_repository():
add_commit_to_repo(git_repo)
fetch(original_uri + "#master^", target, use_cache=True)
assert_equal("Run it.", read_file(os.path.join(target, "README")))
-
-@test
-def remote_connection_is_not_required_when_archiving_cached_tagged_commit():
- with temporary_git_repo() as git_repo:
- original_uri = "git+file://" + git_repo.working_directory
- tag_git_repo(git_repo, "0.1")
- add_commit_to_repo(git_repo)
- with temporary_empty_dir() as target:
- archive(original_uri + "#0.1", target)
-
- with temporary_empty_dir() as target:
- archive(original_uri + "#0.1", target)
- assert_equal("Run it.", read_file(os.path.join(target, "README")))
-
+
+
@test
def error_is_raised_if_target_is_file():
with temporary_empty_dir() as target:

0 comments on commit d9235e3

Please sign in to comment.