Merge lp:~lucio.torre/ubuntuone-client/dont-reorder-deletes into lp:ubuntuone-client

Proposed by Lucio Torre
Status: Merged
Approved by: Guillermo Gonzalez
Approved revision: 718
Merged at revision: 723
Proposed branch: lp:~lucio.torre/ubuntuone-client/dont-reorder-deletes
Merge into: lp:ubuntuone-client
Diff against target: 53 lines (+8/-11)
2 files modified
tests/syncdaemon/test_sync.py (+7/-2)
ubuntuone/syncdaemon/sync.py (+1/-9)
To merge this branch: bzr merge lp:~lucio.torre/ubuntuone-client/dont-reorder-deletes
Reviewer Review Type Date Requested Status
Guillermo Gonzalez Approve
John O'Brien (community) Approve
Review via email: mp+36353@code.launchpad.net

Commit message

make sure we dont reorder deletes

Description of the change

make sure we dont reorder deletes
with this change the conflict is avoided and integration tests pass
i dont know why this was done this way the first time.

To post a comment you must log in.
718. By Lucio Torre

added docs to test

Revision history for this message
John O'Brien (jdobrien) wrote :

go go go!

review: Approve
Revision history for this message
Guillermo Gonzalez (verterok) wrote :

looks good, tests pass.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/syncdaemon/test_sync.py'
--- tests/syncdaemon/test_sync.py 2010-09-15 19:02:52 +0000
+++ tests/syncdaemon/test_sync.py 2010-09-22 18:03:44 +0000
@@ -1349,7 +1349,12 @@
1349 self.handler.records = []1349 self.handler.records = []
13501350
1351 def test_handle_deletes_last(self):1351 def test_handle_deletes_last(self):
1352 """The handler for SV_FILE_DELETED is called last"""1352 """The handler for SV_FILE_DELETED is not called last
1353
1354 If we reorder deletes we will get a fake conflict when a
1355 delete and move that overwrites the deleted file arrives.
1356 """
1357
1353 self.create_filetxt()1358 self.create_filetxt()
1354 self.create_dir()1359 self.create_dir()
13551360
@@ -1373,7 +1378,7 @@
1373 self.sync.handle_AQ_DELTA_OK(**kwargs)1378 self.sync.handle_AQ_DELTA_OK(**kwargs)
13741379
1375 # check that the handlers are called in order1380 # check that the handlers are called in order
1376 self.assertEqual(called, ['hash', 'delete'])1381 self.assertEqual(called, ['delete', 'hash'])
13771382
1378 def test_exception_mark_node_as_dirty(self):1383 def test_exception_mark_node_as_dirty(self):
1379 """We mark the node as dirty and send an event on error."""1384 """We mark the node as dirty and send an event on error."""
13801385
=== modified file 'ubuntuone/syncdaemon/sync.py'
--- ubuntuone/syncdaemon/sync.py 2010-09-15 19:02:52 +0000
+++ ubuntuone/syncdaemon/sync.py 2010-09-22 18:03:44 +0000
@@ -1077,6 +1077,7 @@
1077 # about it1077 # about it
1078 if not dt.is_live:1078 if not dt.is_live:
1079 to_delete.append(dt)1079 to_delete.append(dt)
1080 self._handle_SV_FILE_DELETED(dt.share_id, dt.node_id)
1080 # nothing else should happen with this1081 # nothing else should happen with this
1081 continue1082 continue
10821083
@@ -1146,15 +1147,6 @@
1146 "Node delta for %s:%s can't be applied.",1147 "Node delta for %s:%s can't be applied.",
1147 dt.share_id, dt.node_id)1148 dt.share_id, dt.node_id)
11481149
1149 for dt in to_delete:
1150 try:
1151 # delete all the nodes after applying all deltas
1152 self._handle_SV_FILE_DELETED(dt.share_id, dt.node_id)
1153 except Exception:
1154 self.logger.exception(
1155 "Node delete for %s:%s can't be applied.",
1156 dt.share_id, dt.node_id)
1157
1158 # And mark the node as dirty1150 # And mark the node as dirty
1159 self.mark_node_as_dirty(dt.share_id, dt.node_id)1151 self.mark_node_as_dirty(dt.share_id, dt.node_id)
11601152

Subscribers

People subscribed via source and target branches