summaryrefslogtreecommitdiff
path: root/morphlib/plugins
diff options
context:
space:
mode:
authorDaniel Silverstone <daniel.silverstone@codethink.co.uk>2012-09-14 09:32:45 +0100
committerDaniel Silverstone <daniel.silverstone@codethink.co.uk>2012-09-14 17:14:16 +0100
commitdd4f52f311467240ea2749c773d46b751478381d (patch)
treef6939600c12ad695bf375e452657c8e13f2c9bf2 /morphlib/plugins
parent8d98f5692fb974d081dfb74a64e2f4b861b27461 (diff)
downloadmorph-dd4f52f311467240ea2749c773d46b751478381d.tar.gz
Rework git caches to be bare mirrors of the repos.
This reworks the code for managing and using the git caches in morph to treat the caches as bare repositories which are mirrors of where we clone from. In addition we correctly prune the branches during updates, so that we don't end up accumulating pointless branches over and over. This is even more important with branch-and-merge generating temporary build refs for things.
Diffstat (limited to 'morphlib/plugins')
-rw-r--r--morphlib/plugins/branch_and_merge_plugin.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/morphlib/plugins/branch_and_merge_plugin.py b/morphlib/plugins/branch_and_merge_plugin.py
index d3aced4b..82d83a58 100644
--- a/morphlib/plugins/branch_and_merge_plugin.py
+++ b/morphlib/plugins/branch_and_merge_plugin.py
@@ -194,7 +194,7 @@ class BranchAndMergePlugin(cliapp.Plugin):
os.makedirs(parent_dir)
# Clone it from cache to target directory.
- repo.checkout(ref, os.path.abspath(dirname))
+ repo.clone_checkout(ref, os.path.abspath(dirname))
# Remember the repo name we cloned from in order to be able
# to identify the repo again later using the same name, even
@@ -221,6 +221,9 @@ class BranchAndMergePlugin(cliapp.Plugin):
with open(filename) as f:
text = f.read()
else:
+ ref = morphlib.git.find_first_ref(self.app.runcmd, repo_dir, ref)
+ logging.warning("Running git cat-file blob %s:%s.morph in %s" % (
+ ref, name, repo_dir))
text = self.app.runcmd(['git', 'cat-file', 'blob',
'%s:%s.morph' % (ref, name)], cwd=repo_dir)
morphology = morphlib.morph2.Morphology(text)