← Back to team overview

duplicity-team team mailing list archive

[Merge] lp:~stragerneds/duplicity/duplicity into lp:duplicity/0.7-series

 

Matthew Glazar has proposed merging lp:~stragerneds/duplicity/duplicity into lp:duplicity/0.7-series.

Requested reviews:
  duplicity-team (duplicity-team)

For more details, see:
https://code.launchpad.net/~stragerneds/duplicity/duplicity/+merge/369499
-- 
Your team duplicity-team is requested to review the proposed merge of lp:~stragerneds/duplicity/duplicity into lp:duplicity/0.7-series.
=== modified file 'duplicity/collections.py'
--- duplicity/collections.py	2018-02-01 21:17:08 +0000
+++ duplicity/collections.py	2019-07-01 08:01:43 +0000
@@ -68,7 +68,7 @@
         """
         return self.remote_manifest_name
 
-    def add_filename(self, filename):
+    def add_filename(self, filename, pr=None):
         """
         Add a filename to given set.  Return true if it fits.
 
@@ -78,8 +78,12 @@
 
         @param filename: name of file to add
         @type filename: string
+
+        @param pr: pre-computed result of file_naming.parse(filename)
+        @type pr: Optional[ParseResults]
         """
-        pr = file_naming.parse(filename)
+        if not pr:
+            pr = file_naming.parse(filename)
         if not pr or not (pr.type == "full" or pr.type == "inc"):
             return False
 
@@ -820,14 +824,15 @@
             """
             Try adding filename to existing sets, or make new one
             """
+            pr = file_naming.parse(filename)
             for set in sets:
-                if set.add_filename(filename):
+                if set.add_filename(filename, pr):
                     log.Debug(_("File %s is part of known set") % (util.ufn(filename),))
                     break
             else:
                 log.Debug(_("File %s is not part of a known set; creating new set") % (util.ufn(filename),))
                 new_set = BackupSet(self.backend, self.action)
-                if new_set.add_filename(filename):
+                if new_set.add_filename(filename, pr):
                     sets.append(new_set)
                 else:
                     log.Debug(_("Ignoring file (rejected by backup set) '%s'") % util.ufn(filename))


Follow ups