Commit e8829d3d authored by maruel@chromium.org's avatar maruel@chromium.org

Update upload.py to r746.

R=dpranke@chromium.org
BUG=
TEST=

Review URL: http://codereview.chromium.org/7083006

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@87106 0039d316-1c4b-4281-b951-d872f2087c98
parent 7bbcfc34
...@@ -171,6 +171,7 @@ class ClientLoginError(urllib2.HTTPError): ...@@ -171,6 +171,7 @@ class ClientLoginError(urllib2.HTTPError):
urllib2.HTTPError.__init__(self, url, code, msg, headers, None) urllib2.HTTPError.__init__(self, url, code, msg, headers, None)
self.args = args self.args = args
self.reason = args["Error"] self.reason = args["Error"]
self.info = args.get("Info", None)
class AbstractRpcServer(object): class AbstractRpcServer(object):
...@@ -314,37 +315,42 @@ class AbstractRpcServer(object): ...@@ -314,37 +315,42 @@ class AbstractRpcServer(object):
try: try:
auth_token = self._GetAuthToken(credentials[0], credentials[1]) auth_token = self._GetAuthToken(credentials[0], credentials[1])
except ClientLoginError, e: except ClientLoginError, e:
print >>sys.stderr, ''
if e.reason == "BadAuthentication": if e.reason == "BadAuthentication":
print >>sys.stderr, "Invalid username or password." if e.info == "InvalidSecondFactor":
continue print >>sys.stderr, (
if e.reason == "CaptchaRequired": "Use an application-specific password instead "
"of your regular account password.\n"
"See http://www.google.com/"
"support/accounts/bin/answer.py?answer=185833")
else:
print >>sys.stderr, "Invalid username or password."
elif e.reason == "CaptchaRequired":
print >>sys.stderr, ( print >>sys.stderr, (
"Please go to\n" "Please go to\n"
"https://www.google.com/accounts/DisplayUnlockCaptcha\n" "https://www.google.com/accounts/DisplayUnlockCaptcha\n"
"and verify you are a human. Then try again.\n" "and verify you are a human. Then try again.\n"
"If you are using a Google Apps account the URL is:\n" "If you are using a Google Apps account the URL is:\n"
"https://www.google.com/a/yourdomain.com/UnlockCaptcha") "https://www.google.com/a/yourdomain.com/UnlockCaptcha")
break elif e.reason == "NotVerified":
if e.reason == "NotVerified":
print >>sys.stderr, "Account not verified." print >>sys.stderr, "Account not verified."
break elif e.reason == "TermsNotAgreed":
if e.reason == "TermsNotAgreed":
print >>sys.stderr, "User has not agreed to TOS." print >>sys.stderr, "User has not agreed to TOS."
break elif e.reason == "AccountDeleted":
if e.reason == "AccountDeleted":
print >>sys.stderr, "The user account has been deleted." print >>sys.stderr, "The user account has been deleted."
break elif e.reason == "AccountDisabled":
if e.reason == "AccountDisabled":
print >>sys.stderr, "The user account has been disabled." print >>sys.stderr, "The user account has been disabled."
break break
if e.reason == "ServiceDisabled": elif e.reason == "ServiceDisabled":
print >>sys.stderr, ("The user's access to the service has been " print >>sys.stderr, ("The user's access to the service has been "
"disabled.") "disabled.")
break elif e.reason == "ServiceUnavailable":
if e.reason == "ServiceUnavailable":
print >>sys.stderr, "The service is not available; try again later." print >>sys.stderr, "The service is not available; try again later."
break else:
raise # Unknown error.
raise
print >>sys.stderr, ''
continue
self._GetAuthCookie(auth_token) self._GetAuthCookie(auth_token)
return return
...@@ -1338,7 +1344,7 @@ class CVSVCS(VersionControlSystem): ...@@ -1338,7 +1344,7 @@ class CVSVCS(VersionControlSystem):
cmd.extend(extra_args) cmd.extend(extra_args)
data, retcode = RunShellWithReturnCode(cmd) data, retcode = RunShellWithReturnCode(cmd)
count = 0 count = 0
if retcode == 0: if retcode in [0, 1]:
for line in data.splitlines(): for line in data.splitlines():
if line.startswith("Index:"): if line.startswith("Index:"):
count += 1 count += 1
...@@ -1350,10 +1356,11 @@ class CVSVCS(VersionControlSystem): ...@@ -1350,10 +1356,11 @@ class CVSVCS(VersionControlSystem):
return data return data
def GetUnknownFiles(self): def GetUnknownFiles(self):
status = RunShell(["cvs", "diff"], data, retcode = RunShellWithReturnCode(["cvs", "diff"])
silent_ok=True) if retcode not in [0, 1]:
ErrorExit("Got error status from 'cvs diff':\n%s" % (data,))
unknown_files = [] unknown_files = []
for line in status.split("\n"): for line in data.split("\n"):
if line and line[0] == "?": if line and line[0] == "?":
unknown_files.append(line) unknown_files.append(line)
return unknown_files return unknown_files
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment