objectstore: add clone method for object

Right now this is basically a clone(!) of `export` but this will
change in the future when we change the layout of how objects
are stored.
This commit is contained in:
Christian Kellner 2022-08-19 18:13:15 +02:00
parent c3c06a1ebd
commit 1762048c1f

View file

@ -184,6 +184,20 @@ class Object:
check=True,
)
def clone(self, to_directory: PathLike):
"""Clone the object to the specified directory"""
with self.read() as from_directory:
subprocess.run(
[
"cp",
"--reflink=auto",
"-a",
os.fspath(from_directory) + "/.",
os.fspath(to_directory),
],
check=True,
)
class HostTree:
"""Read-only access to the host file system