Merge lp:~facundo/ubuntuone-client/no-more-initial-empty-files into lp:ubuntuone-client

Proposed by Facundo Batista
Status: Merged
Approved by: Guillermo Gonzalez
Approved revision: 223
Merged at revision: not available
Proposed branch: lp:~facundo/ubuntuone-client/no-more-initial-empty-files
Merge into: lp:ubuntuone-client
Diff against target: 82 lines
3 files modified
ubuntuone/syncdaemon/filesystem_manager.py (+0/-12)
ubuntuone/syncdaemon/local_rescan.py (+9/-2)
ubuntuone/syncdaemon/sync.py (+0/-7)
To merge this branch: bzr merge lp:~facundo/ubuntuone-client/no-more-initial-empty-files
Reviewer Review Type Date Requested Status
Guillermo Gonzalez Approve
John O'Brien (community) Approve
Review via email: mp+12540@code.launchpad.net

Commit message

Locally there're no more zero size files when waiting for be filled with a download.

To post a comment you must log in.
Revision history for this message
Facundo Batista (facundo) wrote :

Locally there're no more zero size files when waiting for be filled with a download.

So I just removed the code that was producing them.

Also, found, fixed and tested a small corruption issue that is fixed right here.

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

great fix

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone/syncdaemon/filesystem_manager.py'
2--- ubuntuone/syncdaemon/filesystem_manager.py 2009-09-22 15:56:46 +0000
3+++ ubuntuone/syncdaemon/filesystem_manager.py 2009-09-28 18:10:35 +0000
4@@ -889,18 +889,6 @@
5
6 return open(self.get_abspath(mdobj['share_id'], mdobj['path']))
7
8- def create_file(self, mdid):
9- '''create the file.'''
10- mdobj = self.fs[mdid]
11- path = self.get_abspath(mdobj['share_id'], mdobj['path'])
12- with self._enable_share_write(mdobj['share_id'], path):
13- if mdobj["is_dir"]:
14- os.mkdir(path)
15- else:
16- # use os.open so this wont raise IN_CLOSE_WRITE
17- fd = os.open(path, os.O_CREAT)
18- os.close(fd)
19-
20 def _share_relative_path(self, share_id, path):
21 """ returns the relative path from the share_id. """
22 share = self._get_share(share_id)
23
24=== modified file 'ubuntuone/syncdaemon/local_rescan.py'
25--- ubuntuone/syncdaemon/local_rescan.py 2009-09-22 15:19:25 +0000
26+++ ubuntuone/syncdaemon/local_rescan.py 2009-09-28 18:10:35 +0000
27@@ -58,8 +58,15 @@
28 log_info("start scan all shares")
29 to_scan = self._get_shares()
30 for share in to_scan:
31- mdobj = self.fsm.get_by_path(share.path)
32- self._queue.appendleft((share, share.path, True, mdobj.mdid))
33+ try:
34+ mdobj = self.fsm.get_by_path(share.path)
35+ except KeyError:
36+ # this could happen in a strange corruption situation where FSM
37+ # lost the share information, so we remove it, because VM will
38+ # download it again
39+ self.vm.share_deleted(share.id)
40+ else:
41+ self._queue.appendleft((share, share.path, True, mdobj.mdid))
42 d = self._queue_scan()
43 d.addCallback(self._process_trash)
44 return d
45
46=== modified file 'ubuntuone/syncdaemon/sync.py'
47--- ubuntuone/syncdaemon/sync.py 2009-09-22 15:19:25 +0000
48+++ ubuntuone/syncdaemon/sync.py 2009-09-28 18:10:35 +0000
49@@ -221,10 +221,6 @@
50 except Exception:
51 return default
52
53- def make_file(self):
54- "create the local empty file"
55- self.fs.create_file(self.get_mdid())
56-
57
58 def loglevel(lvl):
59 """Make a function that logs at lvl log level."""
60@@ -441,14 +437,12 @@
61 def file_conflict(self, event, params, hash, crc32, size, stat):
62 """This file is in conflict."""
63 self.key.move_to_conflict()
64- self.key.make_file()
65
66 def local_file_conflict(self, event, params, hash):
67 """This file is in conflict."""
68 self.key.move_to_conflict()
69 self.m.action_q.cancel_upload(share_id=self.key['share_id'],
70 node_id=self.key['node_id'])
71- self.key.make_file()
72 self.get_file(event, params, hash)
73
74 def merge_directory(self, event, params, hash):
75@@ -553,7 +547,6 @@
76 self.key.set(server_hash="")
77 self.key.set(local_hash="")
78 self.key.sync()
79- self.key.make_file()
80 self.m.action_q.query([(share_id, node_id, "")])
81
82 def new_file_on_server_with_local(self, event, params, share_id,

Subscribers

People subscribed via source and target branches