From: Luke Diamand <luke@diamand.org>
To: git@vger.kernel.org
Cc: "SZEDER Gábor" <szeder.dev@gmail.com>,
"Chen Bin" <chenbin.sh@gmail.com>,
"Miguel Torroja" <miguel.torroja@gmail.com>,
"George Vanburgh" <gvanburgh@bloomberg.net>,
"Merland Romain" <merlorom@yahoo.fr>,
"Vinicius Kursancew" <viniciusalexandre@gmail.com>,
larsxschneider@gmail.com, "Lex Spoon" <lex@lexspoon.org>,
"Johannes Schindelin" <johannes.schindelin@gmx.de>,
"Luke Diamand" <luke@diamand.org>
Subject: [PATCHv2 1/3] git-p4: do not fail in verbose mode for missing 'fileSize' key
Date: Mon, 15 Oct 2018 12:14:06 +0100 [thread overview]
Message-ID: <20181015111408.17618-2-luke@diamand.org> (raw)
In-Reply-To: <20181015111408.17618-1-luke@diamand.org>
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>
---
git-p4.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/git-p4.py b/git-p4.py
index 7fab255584..5701bad06a 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -2775,7 +2775,10 @@ def streamOneP4File(self, file, contents):
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()
--
2.19.1.331.gae0ed827e6
next prev parent reply other threads:[~2018-10-15 11:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-15 11:14 [PATCHv2 0/3] git-p4: improved unshelving - small fixes Luke Diamand
2018-10-15 11:14 ` Luke Diamand [this message]
2018-10-15 11:14 ` [PATCHv2 2/3] git-p4: unshelve into refs/remotes/p4-unshelved, not refs/remotes/p4/unshelved Luke Diamand
2018-10-15 11:14 ` [PATCHv2 3/3] git-p4: fully support unshelving changelists Luke Diamand
2018-10-16 4:27 ` [PATCHv2 0/3] git-p4: improved unshelving - small fixes Junio C Hamano
2018-10-24 11:51 ` Luke Diamand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181015111408.17618-2-luke@diamand.org \
--to=luke@diamand.org \
--cc=chenbin.sh@gmail.com \
--cc=git@vger.kernel.org \
--cc=gvanburgh@bloomberg.net \
--cc=johannes.schindelin@gmx.de \
--cc=larsxschneider@gmail.com \
--cc=lex@lexspoon.org \
--cc=merlorom@yahoo.fr \
--cc=miguel.torroja@gmail.com \
--cc=szeder.dev@gmail.com \
--cc=viniciusalexandre@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).