# The thing in the input file list is a directory on its own. In which case, replace any existing file, or symlink to file
# with the new, blank directory - if it's neither of those things, or doesn't exist, then just create the dir.
iffinself.index:
x=self._resolve(f)
ifxisNone:
# If we're importing a blank directory, and the target has a broken symlink, then do nothing.
pass
elifisinstance(x,remote_execution_pb2.FileNode):
# Files with the same name, or symlinks to files, get removed.
pass
else:
# There's either a symlink (valid or not) or existing directory with this name, so do nothing.
pass
else:
self.create_directory(f)
else:
# We're importing a file or symlink - replace anything with the same name.
@@ -736,17 +763,21 @@ class CasBasedDirectory(Directory):
defshowdiff(self,other):
print("Diffing {} and {}:".format(self,other))
defcompare_list(l1,l2):
defcompare_list(l1,l2,name):
item2=None
index=0
print("Comparing lists: {} vs {}".format([d.namefordinl1],[d.namefordinl2]))
print("Comparing {} lists: {} vs {}".format(name,[d.namefordinl1],[d.namefordinl2]))
foritem1inl1:
ifindex>=len(l2):
print("l2 is short: no item to correspond to '{}' in l1.".format(item1.name))
returnFalse
item2=l2[index]
ifitem1.name!=item2.name:
print("Items do not match: {}, a {} in l1, vs {}, a {} in l2".format(item1.name,self._describe(item1),item2.name,self._describe(item2)))
print("Items do not match in {} list: {}, a {} in l1, vs {}, a {} in l2".format(name,item1.name,self._describe(item1),item2.name,self._describe(item2)))