(self, relPath, contents)
| 1490 | return contentFile.name |
| 1491 | |
| 1492 | def exceedsLargeFileThreshold(self, relPath, contents): |
| 1493 | if gitConfigInt('git-p4.largeFileThreshold'): |
| 1494 | contentsSize = sum(len(d) for d in contents) |
| 1495 | if contentsSize > gitConfigInt('git-p4.largeFileThreshold'): |
| 1496 | return True |
| 1497 | if gitConfigInt('git-p4.largeFileCompressedThreshold'): |
| 1498 | contentsSize = sum(len(d) for d in contents) |
| 1499 | if contentsSize <= gitConfigInt('git-p4.largeFileCompressedThreshold'): |
| 1500 | return False |
| 1501 | contentTempFile = self.generateTempFile(contents) |
| 1502 | compressedContentFile = tempfile.NamedTemporaryFile(prefix='git-p4-large-file', delete=True) |
| 1503 | with zipfile.ZipFile(compressedContentFile, mode='w') as zf: |
| 1504 | zf.write(contentTempFile, compress_type=zipfile.ZIP_DEFLATED) |
| 1505 | compressedContentsSize = zf.infolist()[0].compress_size |
| 1506 | os.remove(contentTempFile) |
| 1507 | if compressedContentsSize > gitConfigInt('git-p4.largeFileCompressedThreshold'): |
| 1508 | return True |
| 1509 | return False |
| 1510 | |
| 1511 | def addLargeFile(self, relPath): |
| 1512 | self.largeFiles.add(relPath) |
no test coverage detected