def _handleContents(self, pathId, fileId, fileStream, configRestoreList, normalRestoreList, oldFileId = None, oldVersion = None, oldfile = None, restoreContents = True): # files with contents need to be tracked so we can stick # their contents in the archive "soon"; config files need # extra magic for tracking since we may have to merge # contents repos = self.repos if not fileStream or not restoreContents: # empty fileStream means there are no contents to restore return hasContents = (files.frozenFileHasContents(fileStream) and not files.frozenFileFlags(fileStream).isEncapsulatedContent()) if not hasContents: return fileFlags = files.frozenFileFlags(fileStream) if self.storeOnlyConfigFiles and not fileFlags.isConfig(): return contentInfo = files.frozenFileContentInfo(fileStream) if fileFlags.isConfig(): tup = (pathId, fileId, contentInfo.sha1(), oldfile, fileId, oldVersion, oldFileId, restoreContents) configRestoreList.append(tup) else: tup = (pathId, fileId, contentInfo.sha1(), restoreContents) normalRestoreList.append(tup)
def removeFile(self, pathId, fileId): stream = self.repos.getFileStream(fileId) sha1 = None if files.frozenFileHasContents(stream): flags = files.frozenFileFlags(stream) if flags.isConfig(): contentInfo = files.frozenFileContentInfo(stream) sha1 = contentInfo.sha1() self.oldFile(pathId, fileId, sha1)
def _handleContents(self, pathId, fileId, fileStream, configRestoreList, normalRestoreList, oldFileId=None, oldVersion=None, oldfile=None, restoreContents=True): # files with contents need to be tracked so we can stick # their contents in the archive "soon"; config files need # extra magic for tracking since we may have to merge # contents repos = self.repos if not fileStream or not restoreContents: # empty fileStream means there are no contents to restore return hasContents = ( files.frozenFileHasContents(fileStream) and not files.frozenFileFlags(fileStream).isEncapsulatedContent()) if not hasContents: return fileFlags = files.frozenFileFlags(fileStream) if self.storeOnlyConfigFiles and not fileFlags.isConfig(): return contentInfo = files.frozenFileContentInfo(fileStream) if fileFlags.isConfig(): tup = (pathId, fileId, contentInfo.sha1(), oldfile, fileId, oldVersion, oldFileId, restoreContents) configRestoreList.append(tup) else: tup = (pathId, fileId, contentInfo.sha1(), restoreContents) normalRestoreList.append(tup)