Skip to content
Snippets Groups Projects
Commit 04592db9 authored by Jim MacArthur's avatar Jim MacArthur
Browse files

_casbaseddirectory.py: add _save() function.

parent 6ca892f0
No related branches found
No related tags found
No related merge requests found
......@@ -561,3 +561,20 @@ class CasBasedDirectory(Directory):
throw an exception. """
raise VirtualDirectoryError("_get_underlying_directory was called on a CAS-backed directory," +
" which has no underlying directory.")
def _save(self, name):
"""Saves this directory into the content cache as a named ref. Used
by remote execution to make references for source directories so they
can be pushed to a remote artifact server.
"""
self._recalculate_recursing_up()
self._recalculate_recursing_down()
(rel_refpath, refname) = os.path.split(name)
refdir = os.path.join(self.cas_directory, 'refs', 'heads', rel_refpath)
refname = os.path.join(refdir, refname)
if not os.path.exists(refdir):
os.makedirs(refdir)
with open(refname, "wb") as f:
f.write(self.ref.SerializeToString())
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment