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
1=== modified file 'magicicada/syncdaemon.py'
2--- magicicada/syncdaemon.py 2010-05-22 16:14:20 +0000
3+++ magicicada/syncdaemon.py 2010-05-22 20:29:30 +0000
4@@ -48,6 +48,9 @@
5 "(MakeFile)\(share_id=(.*?), parent_id=(.*?), name=(.*?), .*")
6 RE_OP_MAKEDIR = re.compile(
7 "(MakeDir)\(share_id=(.*?), parent_id=(.*?), name=(.*?), .*")
8+RE_OP_MOVE = re.compile(
9+ "(Move)\(share_id=(.*?), node_id=(.*?), old_parent_id=(.*?), "
10+ "new_parent_id=(.*?), new_name=(.*?)\)")
11
12 # structure that hold content and queue information
13 QueueData = collections.namedtuple('QueueData', 'operation path share node')
14@@ -283,6 +286,19 @@
15 path = '?' # we should get the real path, no API now
16 return QueueData(operation=op, path=path, node=node, share=share)
17
18+ m = RE_OP_MOVE.match(data)
19+ if m:
20+ op, share, node, old_parent, new_parent, new_name, = m.groups()
21+
22+ # we should get the real info, no API now
23+ old_path = '/?...'
24+ old_name = '?'
25+ new_path = '/?...'
26+ composed_path = "%s/%s -> %s/%s" % (old_path, old_name,
27+ new_path, new_name)
28+ return QueueData(operation=op, path=composed_path,
29+ node=node, share=share)
30+
31 raise ValueError("Not supported MetaQueue data: %r" % data)
32
33 def _process_mq(self, data):
34
35=== modified file 'magicicada/tests/test_syncdaemon.py'
36--- magicicada/tests/test_syncdaemon.py 2010-05-22 16:14:20 +0000
37+++ magicicada/tests/test_syncdaemon.py 2010-05-22 20:29:30 +0000
38@@ -302,6 +302,14 @@
39 cmd = 'Unlink(share_id=a, node_id=b, server_hash=c)'
40 return self._metaqueuechanged_test([cmd], [r])
41
42+ def test_Move(self):
43+ """Test meta with Move."""
44+ r = dict(operation='Move', path='/?.../? -> /?.../e',
45+ share='a', node='b')
46+ cmd = 'Move(share_id=a, node_id=b, old_parent_id=c, '\
47+ 'new_parent_id=d, new_name=e)'
48+ return self._metaqueuechanged_test([cmd], [r])
49+
50 def test_metaqueuechanged_twoitems(self):
51 """Test MetaQueueChanged signal with two items in the queue."""
52 r1 = dict(operation='AccountInquiry', path=None, share=None, node=None)

Subscribers

People subscribed via source and target branches