summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmain.py9
-rw-r--r--project.py7
-rw-r--r--subcmds/sync.py12
3 files changed, 18 insertions, 10 deletions
diff --git a/main.py b/main.py
index 22e6fa42..fda81038 100755
--- a/main.py
+++ b/main.py
@@ -276,10 +276,17 @@ class _UserAgentHandler(urllib2.BaseHandler):
276class _BasicAuthHandler(urllib2.HTTPBasicAuthHandler): 276class _BasicAuthHandler(urllib2.HTTPBasicAuthHandler):
277 def http_error_auth_reqed(self, authreq, host, req, headers): 277 def http_error_auth_reqed(self, authreq, host, req, headers):
278 try: 278 try:
279 old_add_header = req.add_header
280 def _add_header(name, val):
281 val = val.replace('\n', '')
282 old_add_header(name, val)
283 req.add_header = _add_header
279 return urllib2.AbstractBasicAuthHandler.http_error_auth_reqed( 284 return urllib2.AbstractBasicAuthHandler.http_error_auth_reqed(
280 self, authreq, host, req, headers) 285 self, authreq, host, req, headers)
281 except: 286 except:
282 self.reset_retry_count() 287 reset = getattr(self, 'reset_retry_count', None)
288 if reset is not None:
289 reset()
283 raise 290 raise
284 291
285def init_http(): 292def init_http():
diff --git a/project.py b/project.py
index 4bc54de9..b61bcacb 100644
--- a/project.py
+++ b/project.py
@@ -29,6 +29,11 @@ try:
29except ImportError: 29except ImportError:
30 import dummy_threading as _threading 30 import dummy_threading as _threading
31 31
32try:
33 from os import SEEK_END
34except ImportError:
35 SEEK_END = 2
36
32from color import Coloring 37from color import Coloring
33from git_command import GitCommand 38from git_command import GitCommand
34from git_config import GitConfig, IsId, GetSchemeFromUrl 39from git_config import GitConfig, IsId, GetSchemeFromUrl
@@ -1462,7 +1467,7 @@ class Project(object):
1462 done = False 1467 done = False
1463 dest = open(tmpPath, 'a+b') 1468 dest = open(tmpPath, 'a+b')
1464 try: 1469 try:
1465 dest.seek(0, os.SEEK_END) 1470 dest.seek(0, SEEK_END)
1466 pos = dest.tell() 1471 pos = dest.tell()
1467 1472
1468 _urllib_lock.acquire() 1473 _urllib_lock.acquire()
diff --git a/subcmds/sync.py b/subcmds/sync.py
index 244a560b..a3d06922 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -195,15 +195,11 @@ later is required to fix a server side protocol bug.
195 195
196 fetched.add(project.gitdir) 196 fetched.add(project.gitdir)
197 pm.update() 197 pm.update()
198 except BaseException, e: 198 except _FetchError:
199 # Notify the _Fetch() function about all errors.
200 err_event.set() 199 err_event.set()
201 200 except:
202 # If we got our own _FetchError, we don't want a stack trace. 201 err_event.set()
203 # However, if we got something else (something in Sync_NetworkHalf?), 202 raise
204 # we'd like one (so re-raise after we've set err_event).
205 if not isinstance(e, _FetchError):
206 raise
207 finally: 203 finally:
208 if did_lock: 204 if did_lock:
209 lock.release() 205 lock.release()