You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by gi...@apache.org on 2020/12/29 13:13:57 UTC
[buildstream] 36/43: Remove create_directory
This is an automated email from the ASF dual-hosted git repository.
github-bot pushed a commit to branch jmac/cas_to_cas_oct_v2
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit c74845da7bcac6a4ee100094b1a713551b508cb9
Author: Jim MacArthur <ji...@codethink.co.uk>
AuthorDate: Tue Oct 30 10:25:51 2018 +0000
Remove create_directory
---
buildstream/storage/_casbaseddirectory.py | 23 +----------------------
1 file changed, 1 insertion(+), 22 deletions(-)
diff --git a/buildstream/storage/_casbaseddirectory.py b/buildstream/storage/_casbaseddirectory.py
index 092cc52..75184d2 100644
--- a/buildstream/storage/_casbaseddirectory.py
+++ b/buildstream/storage/_casbaseddirectory.py
@@ -141,27 +141,6 @@ class CasBasedDirectory(Directory):
# We don't need to do anything more than that; files were already added ealier, and symlinks are
# part of the directory structure.
- def create_directory(self, name: str) -> Directory:
- """Creates a directory if it does not already exist. This does not
- cause an error if something exists; it will remove files and
- symlinks to files which have the same name in this
- directory. Symlinks to directories with the name 'name' are
- unaltered; it's assumed that the target of that symlink will
- be used.
-
- """
- existing_item = self._find_pb2_entry(name)
- if isinstance(existing_item, remote_execution_pb2.FileNode):
- # Directory imported over file with same name
- self.delete_entry(name)
- elif isinstance(existing_item, remote_execution_pb2.SymlinkNode):
- # Directory imported over symlink with same source name
- if self._symlink_target_is_directory(existing_item):
- return self._force_resolve(name) # That's fine; any files in the source directory should end up at the target of the symlink.
- else:
- self.delete_entry(name) # Symlinks to files get replaced
- return self.descend(name, create=True) # Creates the directory if it doesn't already exist.
-
def _find_pb2_entry(self, name):
if name in self.index:
@@ -563,7 +542,7 @@ class CasBasedDirectory(Directory):
# There's either a symlink (valid or not) or existing directory with this name, so do nothing.
pass
else:
- self.create_directory(f)
+ self.descend(f, create=True)
else:
# We're importing a file or symlink - replace anything with the same name.
print("Import of file/symlink {} into this directory. Removing anything existing...".format(f))