Merge lp:~facundo/magicicada-gui/support-move into lp:magicicada-gui

Proposed by Facundo Batista
Status: Merged
Approved by: Facundo Batista
Approved revision: 22
Merge reported by: Facundo Batista
Merged at revision: not available
Proposed branch: lp:~facundo/magicicada-gui/support-move
Merge into: lp:magicicada-gui
Diff against target: 52 lines (+24/-0)
2 files modified
magicicada/syncdaemon.py (+16/-0)
magicicada/tests/test_syncdaemon.py (+8/-0)
To merge this branch: bzr merge lp:~facundo/magicicada-gui/support-move
Reviewer Review Type Date Requested Status
Natalia Bidart Approve
Review via email: mp+25825@code.launchpad.net

Description of the change

Support the Move op

To post a comment you must log in.
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Niceee

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'magicicada/syncdaemon.py'
--- magicicada/syncdaemon.py 2010-05-22 16:14:20 +0000
+++ magicicada/syncdaemon.py 2010-05-22 20:29:30 +0000
@@ -48,6 +48,9 @@
48 "(MakeFile)\(share_id=(.*?), parent_id=(.*?), name=(.*?), .*")48 "(MakeFile)\(share_id=(.*?), parent_id=(.*?), name=(.*?), .*")
49RE_OP_MAKEDIR = re.compile(49RE_OP_MAKEDIR = re.compile(
50 "(MakeDir)\(share_id=(.*?), parent_id=(.*?), name=(.*?), .*")50 "(MakeDir)\(share_id=(.*?), parent_id=(.*?), name=(.*?), .*")
51RE_OP_MOVE = re.compile(
52 "(Move)\(share_id=(.*?), node_id=(.*?), old_parent_id=(.*?), "
53 "new_parent_id=(.*?), new_name=(.*?)\)")
5154
52# structure that hold content and queue information55# structure that hold content and queue information
53QueueData = collections.namedtuple('QueueData', 'operation path share node')56QueueData = collections.namedtuple('QueueData', 'operation path share node')
@@ -283,6 +286,19 @@
283 path = '?' # we should get the real path, no API now286 path = '?' # we should get the real path, no API now
284 return QueueData(operation=op, path=path, node=node, share=share)287 return QueueData(operation=op, path=path, node=node, share=share)
285288
289 m = RE_OP_MOVE.match(data)
290 if m:
291 op, share, node, old_parent, new_parent, new_name, = m.groups()
292
293 # we should get the real info, no API now
294 old_path = '/?...'
295 old_name = '?'
296 new_path = '/?...'
297 composed_path = "%s/%s -> %s/%s" % (old_path, old_name,
298 new_path, new_name)
299 return QueueData(operation=op, path=composed_path,
300 node=node, share=share)
301
286 raise ValueError("Not supported MetaQueue data: %r" % data)302 raise ValueError("Not supported MetaQueue data: %r" % data)
287303
288 def _process_mq(self, data):304 def _process_mq(self, data):
289305
=== modified file 'magicicada/tests/test_syncdaemon.py'
--- magicicada/tests/test_syncdaemon.py 2010-05-22 16:14:20 +0000
+++ magicicada/tests/test_syncdaemon.py 2010-05-22 20:29:30 +0000
@@ -302,6 +302,14 @@
302 cmd = 'Unlink(share_id=a, node_id=b, server_hash=c)'302 cmd = 'Unlink(share_id=a, node_id=b, server_hash=c)'
303 return self._metaqueuechanged_test([cmd], [r])303 return self._metaqueuechanged_test([cmd], [r])
304304
305 def test_Move(self):
306 """Test meta with Move."""
307 r = dict(operation='Move', path='/?.../? -> /?.../e',
308 share='a', node='b')
309 cmd = 'Move(share_id=a, node_id=b, old_parent_id=c, '\
310 'new_parent_id=d, new_name=e)'
311 return self._metaqueuechanged_test([cmd], [r])
312
305 def test_metaqueuechanged_twoitems(self):313 def test_metaqueuechanged_twoitems(self):
306 """Test MetaQueueChanged signal with two items in the queue."""314 """Test MetaQueueChanged signal with two items in the queue."""
307 r1 = dict(operation='AccountInquiry', path=None, share=None, node=None)315 r1 = dict(operation='AccountInquiry', path=None, share=None, node=None)

Subscribers

People subscribed via source and target branches