← Back to team overview

duplicity-team team mailing list archive

[Merge] lp:~nguyenqmai/duplicity/file-prefix-option into lp:duplicity

 

Kenneth Loafman has proposed merging lp:~nguyenqmai/duplicity/file-prefix-option into lp:duplicity.

Requested reviews:
  duplicity-team (duplicity-team)

For more details, see:
https://code.launchpad.net/~nguyenqmai/duplicity/file-prefix-option/+merge/91585
-- 
https://code.launchpad.net/~nguyenqmai/duplicity/file-prefix-option/+merge/91585
Your team duplicity-team is requested to review the proposed merge of lp:~nguyenqmai/duplicity/file-prefix-option into lp:duplicity.
=== modified file 'bin/duplicity'
--- bin/duplicity	2011-12-21 10:19:28 +0000
+++ bin/duplicity	2012-02-05 18:10:31 +0000
@@ -1221,6 +1221,9 @@
     # determine what action we're performing and process command line
     action = commandline.ProcessCommandLine(sys.argv[1:])
 
+    # update the regex with provided file-prefix
+    file_naming.prepare_regex()
+
     # The following is for starting remote debugging in Eclipse with Pydev.
     # Adjust the path to your location and version of Eclipse and Pydev.
     if globals.pydevd:

=== modified file 'duplicity/commandline.py'
--- duplicity/commandline.py	2011-12-21 10:31:20 +0000
+++ duplicity/commandline.py	2012-02-05 18:10:31 +0000
@@ -321,6 +321,9 @@
     parser.add_option("--fail-on-volume", type="int",
                       help=optparse.SUPPRESS_HELP)
 
+    # used to provide a prefix on top of the defaul tar file name
+    parser.add_option("--file-prefix", type="string", dest="file_prefix", action="store")
+
     # used in testing only - skips upload for a given volume
     parser.add_option("--skip-volume", type="int",
                       help=optparse.SUPPRESS_HELP)

=== modified file 'duplicity/file_naming.py'
--- duplicity/file_naming.py	2010-07-22 19:15:11 +0000
+++ duplicity/file_naming.py	2012-02-05 18:10:31 +0000
@@ -25,47 +25,74 @@
 from duplicity import dup_time
 from duplicity import globals
 
-full_vol_re = re.compile("^duplicity-full"
+full_vol_re = None
+full_vol_re_short = None
+full_manifest_re = None
+full_manifest_re_short = None
+inc_vol_re = None
+inc_vol_re_short = None
+inc_manifest_re = None
+inc_manifest_re_short = None
+full_sig_re = None
+full_sig_re_short = None
+new_sig_re = None
+new_sig_re_short = None
+
+def prepare_regex():
+    global full_vol_re
+    global full_vol_re_short
+    global full_manifest_re
+    global full_manifest_re_short
+    global inc_vol_re
+    global inc_vol_re_short
+    global inc_manifest_re
+    global inc_manifest_re_short
+    global full_sig_re
+    global full_sig_re_short
+    global new_sig_re
+    global new_sig_re_short
+
+    full_vol_re = re.compile("^" + globals.file_prefix + "duplicity-full"
                          "\\.(?P<time>.*?)"
                          "\\.vol(?P<num>[0-9]+)"
                          "\\.difftar"
                          "(?P<partial>(\\.part))?"
                          "($|\\.)")
 
-full_vol_re_short = re.compile("^df"
+    full_vol_re_short = re.compile("^" + globals.file_prefix + "df"
                                "\\.(?P<time>[0-9a-z]+?)"
                                "\\.(?P<num>[0-9a-z]+)"
                                "\\.dt"
                                "(?P<partial>(\\.p))?"
                                "($|\\.)")
 
-full_manifest_re = re.compile("^duplicity-full"
+    full_manifest_re = re.compile("^" + globals.file_prefix + "duplicity-full"
                               "\\.(?P<time>.*?)"
                               "\\.manifest"
                               "(?P<partial>(\\.part))?"
                               "($|\\.)")
 
-full_manifest_re_short = re.compile("^df"
+    full_manifest_re_short = re.compile("^" + globals.file_prefix + "df"
                                     "\\.(?P<time>[0-9a-z]+?)"
                                     "\\.m"
                                     "(?P<partial>(\\.p))?"
                                     "($|\\.)")
 
-inc_vol_re = re.compile("^duplicity-inc"
+    inc_vol_re = re.compile("^" + globals.file_prefix + "duplicity-inc"
                         "\\.(?P<start_time>.*?)"
                         "\\.to\\.(?P<end_time>.*?)"
                         "\\.vol(?P<num>[0-9]+)"
                         "\\.difftar"
                         "($|\\.)")
 
-inc_vol_re_short = re.compile("^di"
+    inc_vol_re_short = re.compile("^" + globals.file_prefix + "di"
                               "\\.(?P<start_time>[0-9a-z]+?)"
                               "\\.(?P<end_time>[0-9a-z]+?)"
                               "\\.(?P<num>[0-9a-z]+)"
                               "\\.dt"
                               "($|\\.)")
 
-inc_manifest_re = re.compile("^duplicity-inc"
+    inc_manifest_re = re.compile("^" + globals.file_prefix + "duplicity-inc"
                              "\\.(?P<start_time>.*?)"
                              "\\.to"
                              "\\.(?P<end_time>.*?)"
@@ -73,26 +100,26 @@
                              "(?P<partial>(\\.part))?"
                              "(\\.|$)")
 
-inc_manifest_re_short = re.compile("^di"
+    inc_manifest_re_short = re.compile("^" + globals.file_prefix + "di"
                                    "\\.(?P<start_time>[0-9a-z]+?)"
                                    "\\.(?P<end_time>[0-9a-z]+?)"
                                    "\\.m"
                                    "(?P<partial>(\\.p))?"
                                    "(\\.|$)")
 
-full_sig_re = re.compile("^duplicity-full-signatures"
+    full_sig_re = re.compile("^" + globals.file_prefix + "duplicity-full-signatures"
                          "\\.(?P<time>.*?)"
                          "\\.sigtar"
                          "(?P<partial>(\\.part))?"
                          "(\\.|$)")
 
-full_sig_re_short = re.compile("^dfs"
+    full_sig_re_short = re.compile("^" + globals.file_prefix + "dfs"
                                "\\.(?P<time>[0-9a-z]+?)"
                                "\\.st"
                                "(?P<partial>(\\.p))?"
                                "(\\.|$)")
 
-new_sig_re = re.compile("^duplicity-new-signatures"
+    new_sig_re = re.compile("^" + globals.file_prefix + "duplicity-new-signatures"
                         "\\.(?P<start_time>.*?)"
                         "\\.to"
                         "\\.(?P<end_time>.*?)"
@@ -100,7 +127,7 @@
                         "(?P<partial>(\\.part))?"
                         "(\\.|$)")
 
-new_sig_re_short = re.compile("^dns"
+    new_sig_re_short = re.compile("^" + globals.file_prefix + "dns"
                               "\\.(?P<start_time>[0-9a-z]+?)"
                               "\\.(?P<end_time>[0-9a-z]+?)"
                               "\\.st"

=== modified file 'duplicity/globals.py'
--- duplicity/globals.py	2011-12-21 10:19:28 +0000
+++ duplicity/globals.py	2012-02-05 18:10:31 +0000
@@ -26,6 +26,9 @@
 # The current version of duplicity
 version = "$version"
 
+# Default file_prefix value
+file_prefix = ""
+
 # The name of the current host, or None if it cannot be set
 hostname = socket.getfqdn()
 


Follow ups