Merge branch 'pm/p4-auto-delete-named-temporary'
* pm/p4-auto-delete-named-temporary: git-p4: auto-delete named temporary file
This commit is contained in:
commit
2e956f7fb3
13
git-p4.py
13
git-p4.py
@ -1160,13 +1160,11 @@ class LargeFileSystem(object):
|
|||||||
if contentsSize <= gitConfigInt('git-p4.largeFileCompressedThreshold'):
|
if contentsSize <= gitConfigInt('git-p4.largeFileCompressedThreshold'):
|
||||||
return False
|
return False
|
||||||
contentTempFile = self.generateTempFile(contents)
|
contentTempFile = self.generateTempFile(contents)
|
||||||
compressedContentFile = tempfile.NamedTemporaryFile(prefix='git-p4-large-file', delete=False)
|
compressedContentFile = tempfile.NamedTemporaryFile(prefix='git-p4-large-file', delete=True)
|
||||||
zf = zipfile.ZipFile(compressedContentFile.name, mode='w')
|
with zipfile.ZipFile(compressedContentFile, mode='w') as zf:
|
||||||
zf.write(contentTempFile, compress_type=zipfile.ZIP_DEFLATED)
|
zf.write(contentTempFile, compress_type=zipfile.ZIP_DEFLATED)
|
||||||
zf.close()
|
compressedContentsSize = zf.infolist()[0].compress_size
|
||||||
compressedContentsSize = zf.infolist()[0].compress_size
|
|
||||||
os.remove(contentTempFile)
|
os.remove(contentTempFile)
|
||||||
os.remove(compressedContentFile.name)
|
|
||||||
if compressedContentsSize > gitConfigInt('git-p4.largeFileCompressedThreshold'):
|
if compressedContentsSize > gitConfigInt('git-p4.largeFileCompressedThreshold'):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
@ -3525,8 +3523,9 @@ class P4Sync(Command, P4UserMap):
|
|||||||
self.updateOptionDict(details)
|
self.updateOptionDict(details)
|
||||||
try:
|
try:
|
||||||
self.commit(details, self.extractFilesFromCommit(details), self.branch)
|
self.commit(details, self.extractFilesFromCommit(details), self.branch)
|
||||||
except IOError:
|
except IOError as err:
|
||||||
print("IO error with git fast-import. Is your git version recent enough?")
|
print("IO error with git fast-import. Is your git version recent enough?")
|
||||||
|
print("IO error details: {}".format(err))
|
||||||
print(self.gitError.read())
|
print(self.gitError.read())
|
||||||
|
|
||||||
def openStreams(self):
|
def openStreams(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user