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

Proposed by Kenneth Loafman
Status: Merged
Merged at revision: 827
Proposed branch: lp:~nguyenqmai/duplicity/file-prefix-option
Merge into: lp:duplicity/0.6
Diff against target: 166 lines (+48/-12)
4 files modified
bin/duplicity (+3/-0)
duplicity/commandline.py (+3/-0)
duplicity/file_naming.py (+39/-12)
duplicity/globals.py (+3/-0)
To merge this branch: bzr merge lp:~nguyenqmai/duplicity/file-prefix-option
Reviewer Review Type Date Requested Status
duplicity-team Pending
Review via email: mp+91585@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/duplicity'
2--- bin/duplicity 2011-12-21 10:19:28 +0000
3+++ bin/duplicity 2012-02-05 18:10:31 +0000
4@@ -1221,6 +1221,9 @@
5 # determine what action we're performing and process command line
6 action = commandline.ProcessCommandLine(sys.argv[1:])
7
8+ # update the regex with provided file-prefix
9+ file_naming.prepare_regex()
10+
11 # The following is for starting remote debugging in Eclipse with Pydev.
12 # Adjust the path to your location and version of Eclipse and Pydev.
13 if globals.pydevd:
14
15=== modified file 'duplicity/commandline.py'
16--- duplicity/commandline.py 2011-12-21 10:31:20 +0000
17+++ duplicity/commandline.py 2012-02-05 18:10:31 +0000
18@@ -321,6 +321,9 @@
19 parser.add_option("--fail-on-volume", type="int",
20 help=optparse.SUPPRESS_HELP)
21
22+ # used to provide a prefix on top of the defaul tar file name
23+ parser.add_option("--file-prefix", type="string", dest="file_prefix", action="store")
24+
25 # used in testing only - skips upload for a given volume
26 parser.add_option("--skip-volume", type="int",
27 help=optparse.SUPPRESS_HELP)
28
29=== modified file 'duplicity/file_naming.py'
30--- duplicity/file_naming.py 2010-07-22 19:15:11 +0000
31+++ duplicity/file_naming.py 2012-02-05 18:10:31 +0000
32@@ -25,47 +25,74 @@
33 from duplicity import dup_time
34 from duplicity import globals
35
36-full_vol_re = re.compile("^duplicity-full"
37+full_vol_re = None
38+full_vol_re_short = None
39+full_manifest_re = None
40+full_manifest_re_short = None
41+inc_vol_re = None
42+inc_vol_re_short = None
43+inc_manifest_re = None
44+inc_manifest_re_short = None
45+full_sig_re = None
46+full_sig_re_short = None
47+new_sig_re = None
48+new_sig_re_short = None
49+
50+def prepare_regex():
51+ global full_vol_re
52+ global full_vol_re_short
53+ global full_manifest_re
54+ global full_manifest_re_short
55+ global inc_vol_re
56+ global inc_vol_re_short
57+ global inc_manifest_re
58+ global inc_manifest_re_short
59+ global full_sig_re
60+ global full_sig_re_short
61+ global new_sig_re
62+ global new_sig_re_short
63+
64+ full_vol_re = re.compile("^" + globals.file_prefix + "duplicity-full"
65 "\\.(?P<time>.*?)"
66 "\\.vol(?P<num>[0-9]+)"
67 "\\.difftar"
68 "(?P<partial>(\\.part))?"
69 "($|\\.)")
70
71-full_vol_re_short = re.compile("^df"
72+ full_vol_re_short = re.compile("^" + globals.file_prefix + "df"
73 "\\.(?P<time>[0-9a-z]+?)"
74 "\\.(?P<num>[0-9a-z]+)"
75 "\\.dt"
76 "(?P<partial>(\\.p))?"
77 "($|\\.)")
78
79-full_manifest_re = re.compile("^duplicity-full"
80+ full_manifest_re = re.compile("^" + globals.file_prefix + "duplicity-full"
81 "\\.(?P<time>.*?)"
82 "\\.manifest"
83 "(?P<partial>(\\.part))?"
84 "($|\\.)")
85
86-full_manifest_re_short = re.compile("^df"
87+ full_manifest_re_short = re.compile("^" + globals.file_prefix + "df"
88 "\\.(?P<time>[0-9a-z]+?)"
89 "\\.m"
90 "(?P<partial>(\\.p))?"
91 "($|\\.)")
92
93-inc_vol_re = re.compile("^duplicity-inc"
94+ inc_vol_re = re.compile("^" + globals.file_prefix + "duplicity-inc"
95 "\\.(?P<start_time>.*?)"
96 "\\.to\\.(?P<end_time>.*?)"
97 "\\.vol(?P<num>[0-9]+)"
98 "\\.difftar"
99 "($|\\.)")
100
101-inc_vol_re_short = re.compile("^di"
102+ inc_vol_re_short = re.compile("^" + globals.file_prefix + "di"
103 "\\.(?P<start_time>[0-9a-z]+?)"
104 "\\.(?P<end_time>[0-9a-z]+?)"
105 "\\.(?P<num>[0-9a-z]+)"
106 "\\.dt"
107 "($|\\.)")
108
109-inc_manifest_re = re.compile("^duplicity-inc"
110+ inc_manifest_re = re.compile("^" + globals.file_prefix + "duplicity-inc"
111 "\\.(?P<start_time>.*?)"
112 "\\.to"
113 "\\.(?P<end_time>.*?)"
114@@ -73,26 +100,26 @@
115 "(?P<partial>(\\.part))?"
116 "(\\.|$)")
117
118-inc_manifest_re_short = re.compile("^di"
119+ inc_manifest_re_short = re.compile("^" + globals.file_prefix + "di"
120 "\\.(?P<start_time>[0-9a-z]+?)"
121 "\\.(?P<end_time>[0-9a-z]+?)"
122 "\\.m"
123 "(?P<partial>(\\.p))?"
124 "(\\.|$)")
125
126-full_sig_re = re.compile("^duplicity-full-signatures"
127+ full_sig_re = re.compile("^" + globals.file_prefix + "duplicity-full-signatures"
128 "\\.(?P<time>.*?)"
129 "\\.sigtar"
130 "(?P<partial>(\\.part))?"
131 "(\\.|$)")
132
133-full_sig_re_short = re.compile("^dfs"
134+ full_sig_re_short = re.compile("^" + globals.file_prefix + "dfs"
135 "\\.(?P<time>[0-9a-z]+?)"
136 "\\.st"
137 "(?P<partial>(\\.p))?"
138 "(\\.|$)")
139
140-new_sig_re = re.compile("^duplicity-new-signatures"
141+ new_sig_re = re.compile("^" + globals.file_prefix + "duplicity-new-signatures"
142 "\\.(?P<start_time>.*?)"
143 "\\.to"
144 "\\.(?P<end_time>.*?)"
145@@ -100,7 +127,7 @@
146 "(?P<partial>(\\.part))?"
147 "(\\.|$)")
148
149-new_sig_re_short = re.compile("^dns"
150+ new_sig_re_short = re.compile("^" + globals.file_prefix + "dns"
151 "\\.(?P<start_time>[0-9a-z]+?)"
152 "\\.(?P<end_time>[0-9a-z]+?)"
153 "\\.st"
154
155=== modified file 'duplicity/globals.py'
156--- duplicity/globals.py 2011-12-21 10:19:28 +0000
157+++ duplicity/globals.py 2012-02-05 18:10:31 +0000
158@@ -26,6 +26,9 @@
159 # The current version of duplicity
160 version = "$version"
161
162+# Default file_prefix value
163+file_prefix = ""
164+
165 # The name of the current host, or None if it cannot be set
166 hostname = socket.getfqdn()
167

Subscribers

People subscribed via source and target branches