mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-04 10:10:58 +00:00
Simply conflict detection by removing nested if statements
This commit is contained in:
parent
e926c4cf2b
commit
52f27dfdc6
@ -708,25 +708,19 @@ class Downloader(QueueMixin, WriteFileMixin):
|
|||||||
else:
|
else:
|
||||||
is_conflict = False
|
is_conflict = False
|
||||||
db_entry = self._db.get_db_entry(relpath_u)
|
db_entry = self._db.get_db_entry(relpath_u)
|
||||||
|
dmd_last_downloaded_uri = metadata.get('last_downloaded_uri', None)
|
||||||
|
dmd_last_uploaded_uri = metadata.get('last_uploaded_uri', None)
|
||||||
if db_entry:
|
if db_entry:
|
||||||
dmd_last_downloaded_uri = metadata.get('last_downloaded_uri', None)
|
|
||||||
print "metadata %r" % (metadata,)
|
|
||||||
print "<<<<--- if %r != %r" % (dmd_last_downloaded_uri, db_entry.last_downloaded_uri)
|
|
||||||
if dmd_last_downloaded_uri is not None and db_entry.last_downloaded_uri is not None:
|
if dmd_last_downloaded_uri is not None and db_entry.last_downloaded_uri is not None:
|
||||||
if dmd_last_downloaded_uri != db_entry.last_downloaded_uri:
|
if dmd_last_downloaded_uri != db_entry.last_downloaded_uri:
|
||||||
is_conflict = True
|
is_conflict = True
|
||||||
self._count('objects_conflicted')
|
self._count('objects_conflicted')
|
||||||
else:
|
elif dmd_last_uploaded_uri is not None and dmd_last_uploaded_uri != db_entry.last_uploaded_uri:
|
||||||
dmd_last_uploaded_uri = metadata.get('last_uploaded_uri', None)
|
is_conflict = True
|
||||||
print ">>>> if %r != %r" % (dmd_last_uploaded_uri, db_entry.last_uploaded_uri)
|
self._count('objects_conflicted')
|
||||||
if dmd_last_uploaded_uri is not None and dmd_last_uploaded_uri != db_entry.last_uploaded_uri:
|
elif self._is_upload_pending(relpath_u):
|
||||||
is_conflict = True
|
is_conflict = True
|
||||||
self._count('objects_conflicted')
|
self._count('objects_conflicted')
|
||||||
else:
|
|
||||||
# XXX todo: mark as conflict if file is in pending upload set
|
|
||||||
if self._is_upload_pending(relpath_u):
|
|
||||||
is_conflict = True
|
|
||||||
self._count('objects_conflicted')
|
|
||||||
|
|
||||||
if relpath_u.endswith(u"/"):
|
if relpath_u.endswith(u"/"):
|
||||||
if metadata.get('deleted', False):
|
if metadata.get('deleted', False):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user