~aaron-whitehouse/duplicity/bug_884371

« back to all changes in this revision

Viewing changes to duplicity/backends/pydrivebackend.py

  • Committer: Kenneth Loafman
  • Date: 2015-06-17 18:20:51 UTC
  • Revision ID: kenneth@loafman.com-20150617182051-mf1fphvh524c628c
* Fixed bug 1466160 - pydrive backend is slow to remove old backup set - with
  patch from Kuang-che Wu to implement _delete_list().

Show diffs side-by-side

added added

removed removed

Lines of Context:
100
100
        drive_file = self.drive.CreateFile({'id': file_id})
101
101
        drive_file.auth.service.files().delete(fileId=drive_file['id']).execute()
102
102
 
 
103
    def _delete_list(self, filename_list):
 
104
        to_remove = set(filename_list)
 
105
        for item in self.FilesList():
 
106
            if item['title'] not in to_remove:
 
107
                continue
 
108
            file_id = item['id']
 
109
            drive_file = self.drive.CreateFile({'id': file_id})
 
110
            drive_file.auth.service.files().delete(fileId=drive_file['id']).execute()
 
111
 
103
112
    def _query(self, filename):
104
113
        try:
105
114
            size = int((item for item in self.FilesList() if item['title'] == filename).next()['fileSize'])