~noizyland/duplicity/fix-progress

« back to all changes in this revision

Viewing changes to duplicity/statistics.py

  • Committer: Kenneth Loafman
  • Date: 2015-05-08 12:28:47 UTC
  • Revision ID: kenneth@loafman.com-20150508122847-z6dxdm3qqgumugef
* Added ability to get single file status from collection-status with
  patch from jitao (bug 1044715), like so:
  $ duplicity collection-status --file-changed c1 file://./foo

Show diffs side-by-side

added added

removed removed

Lines of Context:
306
306
            self.__dict__[attr] = 0
307
307
        self.Errors = 0
308
308
        self.StartTime = time.time()
 
309
        self.files_changed = []
309
310
 
310
311
    def add_new_file(self, path):
311
312
        """Add stats of new file path to statistics"""
315
316
        self.NewFiles += 1
316
317
        self.NewFileSize += filesize
317
318
        self.DeltaEntries += 1
 
319
        self.add_delta_entries_file(path, 'new')
318
320
 
319
321
    def add_changed_file(self, path):
320
322
        """Add stats of file that has changed since last backup"""
324
326
        self.ChangedFiles += 1
325
327
        self.ChangedFileSize += filesize
326
328
        self.DeltaEntries += 1
 
329
        self.add_delta_entries_file(path, 'changed')
327
330
 
328
 
    def add_deleted_file(self):
 
331
    def add_deleted_file(self, path):
329
332
        """Add stats of file no longer in source directory"""
330
333
        self.DeletedFiles += 1  # can't add size since not available
331
334
        self.DeltaEntries += 1
 
335
        self.add_delta_entries_file(path, 'deleted')
332
336
 
333
337
    def add_unchanged_file(self, path):
334
338
        """Add stats of file that hasn't changed since last backup"""
339
343
    def close(self):
340
344
        """End collection of data, set EndTime"""
341
345
        self.EndTime = time.time()
 
346
 
 
347
    def add_delta_entries_file(self, path, action_type):
 
348
        if path.isreg():
 
349
            self.files_changed.append((path.get_relative_path(), action_type))
 
350
 
 
351
    def get_delta_entries_file(self):
 
352
        return self.files_changed