~verterok/ubuntuone-client/fix-452682

« back to all changes in this revision

Viewing changes to ubuntuone/syncdaemon/local_rescan.py

  • Committer: Tarmac
  • Author(s): facundo at com
  • Date: 2010-04-16 19:20:16 UTC
  • mfrom: (499.1.1 lr-file-deletion-564774)
  • Revision ID: dobey@wayofthemonkey.com-20100416192016-u9xi0moyp59fw203
Don't delete the file in an interrupted download with lost partial.

Show diffs side-by-side

added added

removed removed

Lines of Context:
507
507
                    else:
508
508
                        events.append(('FS_FILE_DELETE', fullname))
509
509
            else:
510
 
                if changed not in ("SERVER", "NONE", "LOCAL"):
 
510
                if changed == 'SERVER':
 
511
                    # download interruped and partial lost
 
512
                    log_debug("comp yield: file %r not in disk, in SERVER "
 
513
                              "state, without partial!", fullname)
 
514
                    mdobj = self.fsm.get_by_path(fullname)
 
515
                    self.fsm.set_by_mdid(mdobj.mdid,
 
516
                                         server_hash=mdobj.local_hash)
 
517
                    self.fsm.remove_partial(mdobj.node_id, mdobj.share_id)
 
518
                elif changed in ('NONE', 'LOCAL'):
 
519
                    # if it had content somewhen, now is really gone (otherwise
 
520
                    # it was never really created in the disk)
 
521
                    log_info("comp yield: file %r is gone!", fullname)
 
522
                    events.append(('FS_FILE_DELETE', fullname))
 
523
                else:
511
524
                    # bad metadata
512
525
                    m = "Bad 'changed': removing MD from file %r"
513
526
                    log_debug(m, fullname)
514
527
                    self.fsm.delete_metadata(fullname)
515
 
                    continue
516
528
 
517
 
                # if it had content somewhen, now is gone (otherwise it was
518
 
                # never really created in the disk)
519
 
                log_info("comp yield: file %r is gone!", fullname)
520
 
                events.append(('FS_FILE_DELETE', fullname))
521
529
        return events, to_scan_later
522
530
 
523
531
    def _paths_filter(self, shrinfo, dirpath, len_shr_path):