Merge branch 'master' into next

Conflicts:
	Changelog.draft.rst
This commit is contained in:
Nicolas Sebrecht 2011-05-05 21:16:02 +02:00
commit c6259fbb86
4 changed files with 12 additions and 5 deletions

View File

@ -33,6 +33,7 @@ Bug Fixes
* Drop connection if synchronisation failed. This is needed if resuming the * Drop connection if synchronisation failed. This is needed if resuming the
system from suspend mode gives a wrong connection. system from suspend mode gives a wrong connection.
* Fix the offlineimap crash when invoking debug option 'thread'
Pending for the next major release Pending for the next major release

View File

@ -77,8 +77,13 @@ class LocalStatusFolder(BaseFolder):
assert(line == magicline) assert(line == magicline)
for line in file.xreadlines(): for line in file.xreadlines():
line = line.strip() line = line.strip()
uid, flags = line.split(':') try:
uid = long(uid) uid, flags = line.split(':')
uid = long(uid)
except ValueError, e:
errstr = "Corrupt line '%s' in cache file '%s'" % (line, self.filename)
self.ui.warn(errstr)
raise ValueError(errstr)
flags = [x for x in flags] flags = [x for x in flags]
self.messagelist[uid] = {'uid': uid, 'flags': flags} self.messagelist[uid] = {'uid': uid, 'flags': flags}
file.close() file.close()

View File

@ -220,7 +220,7 @@ class OfflineImap:
if not ('thread' in options.debugtype.split(',') \ if not ('thread' in options.debugtype.split(',') \
and options.singlethreading): and options.singlethreading):
ui._msg("Debug mode: Forcing to singlethreaded.") ui._msg("Debug mode: Forcing to singlethreaded.")
options.singlethreaded = True options.singlethreading = True
debugtypes = options.debugtype.split(',') + [''] debugtypes = options.debugtype.split(',') + ['']
for type in debugtypes: for type in debugtypes:
@ -228,8 +228,6 @@ class OfflineImap:
ui.add_debug(type) ui.add_debug(type)
if type.lower() == 'imap': if type.lower() == 'imap':
imaplib.Debug = 5 imaplib.Debug = 5
if type.lower() == 'thread':
threading._VERBOSE = 1
if options.runonce: if options.runonce:
# FIXME: maybe need a better # FIXME: maybe need a better

View File

@ -92,11 +92,14 @@ class UIBase:
(threading.currentThread().getName(), (threading.currentThread().getName(),
s.getthreadaccount(s), account) s.getthreadaccount(s), account)
s.threadaccounts[threading.currentThread()] = account s.threadaccounts[threading.currentThread()] = account
s.debug('thread', "Register new thread '%s' (account '%s')" %\
(threading.currentThread().getName(), account))
def unregisterthread(s, thr): def unregisterthread(s, thr):
"""Recognizes a thread has exited.""" """Recognizes a thread has exited."""
if s.threadaccounts.has_key(thr): if s.threadaccounts.has_key(thr):
del s.threadaccounts[thr] del s.threadaccounts[thr]
s.debug('thread', "Unregister thread '%s'" % thr.getName())
def getthreadaccount(s, thr = None): def getthreadaccount(s, thr = None):
if not thr: if not thr: