From 082cccdbb4a7fb637d642c20ff1cfaf7ccb60f91 Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Tue, 8 Feb 2011 14:31:06 +0000 Subject: [PATCH] Partial update of upload.py with r660 patch. Make json files known as a text mimetype so that they can be seen in reviews. Original review at http://codereview.appspot.com/4133046/ Also make sure that the copy in third_party and in git_cl are the same. I'll remove the copy in git_cl in a later change. git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@74116 0039d316-1c4b-4281-b951-d872f2087c98 --- git_cl/upload.py | 14 +++++++++++--- third_party/upload.py | 6 +++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/git_cl/upload.py b/git_cl/upload.py index f7a2bf5d9..ff7d3f33e 100644 --- a/git_cl/upload.py +++ b/git_cl/upload.py @@ -90,9 +90,9 @@ VCS_UNKNOWN = "Unknown" # whitelist for non-binary filetypes which do not start with "text/" # .mm (Objective-C) shows up as application/x-freemind on my Linux box. -TEXT_MIMETYPES = ['application/javascript', 'application/x-javascript', - 'application/xml', 'application/x-freemind', - 'application/x-sh'] +TEXT_MIMETYPES = ['application/javascript', 'application/json', + 'application/x-javascript', 'application/xml', + 'application/x-freemind', 'application/x-sh'] VCS_ABBREVIATIONS = { VCS_MERCURIAL.lower(): VCS_MERCURIAL, @@ -416,6 +416,14 @@ class AbstractRpcServer(object): url = e.info()["location"] else: raise + except urllib2.URLError, e: + reason = getattr(e, 'reason', None) + if isinstance(reason, str) and reason.find("110") != -1: + # Connection timeout error. + if tries <= 3: + # Try again. + continue + raise finally: socket.setdefaulttimeout(old_timeout) diff --git a/third_party/upload.py b/third_party/upload.py index a49d533af..ff7d3f33e 100755 --- a/third_party/upload.py +++ b/third_party/upload.py @@ -90,9 +90,9 @@ VCS_UNKNOWN = "Unknown" # whitelist for non-binary filetypes which do not start with "text/" # .mm (Objective-C) shows up as application/x-freemind on my Linux box. -TEXT_MIMETYPES = ['application/javascript', 'application/x-javascript', - 'application/xml', 'application/x-freemind', - 'application/x-sh'] +TEXT_MIMETYPES = ['application/javascript', 'application/json', + 'application/x-javascript', 'application/xml', + 'application/x-freemind', 'application/x-sh'] VCS_ABBREVIATIONS = { VCS_MERCURIAL.lower(): VCS_MERCURIAL,