summaryrefslogtreecommitdiff
path: root/git-p4.py
diff options
context:
space:
mode:
authorLuke Diamand <luke@diamand.org>2018-10-12 05:28:31 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-10-12 13:38:29 (GMT)
commit0742b7c860a4291868dec79b90a217db6b129d2b (patch)
tree940ea57b331bb51c2c3b438e2f32634fff29f2cb /git-p4.py
parent5a0cc8aca797dbd7d2be3b67458ff880ed45cddf (diff)
downloadgit-0742b7c860a4291868dec79b90a217db6b129d2b.zip
git-0742b7c860a4291868dec79b90a217db6b129d2b.tar.gz
git-0742b7c860a4291868dec79b90a217db6b129d2b.tar.bz2
git-p4: do not fail in verbose mode for missing 'fileSize' key
If deleting or moving a file, sometimes P4 doesn't report the file size. The code handles this just fine but some logging crashes. Stop this happening. There was some earlier discussion on the list about this: https://public-inbox.org/git/xmqq1sqpp1vv.fsf@gitster.mtv.corp.google.com/ Signed-off-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-p4.py')
-rwxr-xr-xgit-p4.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/git-p4.py b/git-p4.py
index 7fab255..5701bad 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -2775,7 +2775,10 @@ class P4Sync(Command, P4UserMap):
relPath = self.stripRepoPath(file['depotFile'], self.branchPrefixes)
relPath = self.encodeWithUTF8(relPath)
if verbose:
- size = int(self.stream_file['fileSize'])
+ if 'fileSize' in self.stream_file:
+ size = int(self.stream_file['fileSize'])
+ else:
+ size = 0 # deleted files don't get a fileSize apparently
sys.stdout.write('\r%s --> %s (%i MB)\n' % (file['depotFile'], relPath, size/1024/1024))
sys.stdout.flush()