mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Fix Python 2.4 support
Change-Id: I89521ae52fa564f0d849cc51e71fee65b3c47bab Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
parent
fab96c68e3
commit
df5ee52050
9
main.py
9
main.py
@ -276,10 +276,17 @@ class _UserAgentHandler(urllib2.BaseHandler):
|
|||||||
class _BasicAuthHandler(urllib2.HTTPBasicAuthHandler):
|
class _BasicAuthHandler(urllib2.HTTPBasicAuthHandler):
|
||||||
def http_error_auth_reqed(self, authreq, host, req, headers):
|
def http_error_auth_reqed(self, authreq, host, req, headers):
|
||||||
try:
|
try:
|
||||||
|
old_add_header = req.add_header
|
||||||
|
def _add_header(name, val):
|
||||||
|
val = val.replace('\n', '')
|
||||||
|
old_add_header(name, val)
|
||||||
|
req.add_header = _add_header
|
||||||
return urllib2.AbstractBasicAuthHandler.http_error_auth_reqed(
|
return urllib2.AbstractBasicAuthHandler.http_error_auth_reqed(
|
||||||
self, authreq, host, req, headers)
|
self, authreq, host, req, headers)
|
||||||
except:
|
except:
|
||||||
self.reset_retry_count()
|
reset = getattr(self, 'reset_retry_count', None)
|
||||||
|
if reset is not None:
|
||||||
|
reset()
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def init_http():
|
def init_http():
|
||||||
|
@ -29,6 +29,11 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
import dummy_threading as _threading
|
import dummy_threading as _threading
|
||||||
|
|
||||||
|
try:
|
||||||
|
from os import SEEK_END
|
||||||
|
except ImportError:
|
||||||
|
SEEK_END = 2
|
||||||
|
|
||||||
from color import Coloring
|
from color import Coloring
|
||||||
from git_command import GitCommand
|
from git_command import GitCommand
|
||||||
from git_config import GitConfig, IsId, GetSchemeFromUrl
|
from git_config import GitConfig, IsId, GetSchemeFromUrl
|
||||||
@ -1462,7 +1467,7 @@ class Project(object):
|
|||||||
done = False
|
done = False
|
||||||
dest = open(tmpPath, 'a+b')
|
dest = open(tmpPath, 'a+b')
|
||||||
try:
|
try:
|
||||||
dest.seek(0, os.SEEK_END)
|
dest.seek(0, SEEK_END)
|
||||||
pos = dest.tell()
|
pos = dest.tell()
|
||||||
|
|
||||||
_urllib_lock.acquire()
|
_urllib_lock.acquire()
|
||||||
|
@ -195,14 +195,10 @@ later is required to fix a server side protocol bug.
|
|||||||
|
|
||||||
fetched.add(project.gitdir)
|
fetched.add(project.gitdir)
|
||||||
pm.update()
|
pm.update()
|
||||||
except BaseException, e:
|
except _FetchError:
|
||||||
# Notify the _Fetch() function about all errors.
|
err_event.set()
|
||||||
|
except:
|
||||||
err_event.set()
|
err_event.set()
|
||||||
|
|
||||||
# If we got our own _FetchError, we don't want a stack trace.
|
|
||||||
# However, if we got something else (something in Sync_NetworkHalf?),
|
|
||||||
# we'd like one (so re-raise after we've set err_event).
|
|
||||||
if not isinstance(e, _FetchError):
|
|
||||||
raise
|
raise
|
||||||
finally:
|
finally:
|
||||||
if did_lock:
|
if did_lock:
|
||||||
|
Loading…
Reference in New Issue
Block a user