Logo Search packages:      
Sourcecode: ubuntuone-client version File versions

def ubuntuone::syncdaemon::filesystem_manager::FileSystemManager::move_to_conflict (   self,
  mdid 
)

Moves a file/dir to its .conflict.

Definition at line 523 of file filesystem_manager.py.

00523                                     :
        '''Moves a file/dir to its .conflict.'''
        mdobj = self.fs[mdid]
        path = self.get_abspath(mdobj['share_id'], mdobj['path'])
        logger("move_to_conflict: path=%r mdid=%r" % (path, mdid))
        base_to_path = to_path =  path + ".conflict"
        ind = 0
        while os.path.exists(to_path):
            ind += 1
            to_path = base_to_path + "." + str(ind)
        with self._enable_share_write(mdobj['share_id'], path):
            try:
                os.rename(path, to_path)
            except OSError, e:
                if e.errno == errno.ENOENT:
                    m = "Already removed when trying to move to conflict: %r"
                    log_warning(m, path)
                else:
                    raise

        for p, is_dir in self.get_paths_starting_with(path):
            if p == path:
                continue
            if is_dir:
                # remove inotify watch
                try:
                    self.vm.m.event_q.inotify_rm_watch(p)
                except TypeError, e:
                    # pyinotify has an ugly error management, if we can call
                    # it that, :(. We handle this here because it's possible
                    # and correct that the path is not there anymore
                    m = "Error %s when trying to remove the watch on %r"
                    log_warning(m, e, path)

            self.delete_metadata(p)
        mdobj["info"]["last_conflicted"] = time.time()
        self.fs[mdid] = mdobj

    def _check_partial(self, mdid):


Generated by  Doxygen 1.6.0   Back to index