Merge lp:~aaron-whitehouse/duplicity/filelist_combine into lp:~duplicity-team/duplicity/0.7-series

Proposed by Aaron Whitehouse
Status: Merged
Merged at revision: 1081
Proposed branch: lp:~aaron-whitehouse/duplicity/filelist_combine
Merge into: lp:~duplicity-team/duplicity/0.7-series
Diff against target: 2740 lines (+683/-919)
7 files modified
bin/duplicity.1 (+20/-82)
duplicity/commandline.py (+27/-4)
duplicity/selection.py (+27/-128)
po/duplicity.pot (+99/-106)
testing/functional/test_selection.py (+203/-193)
testing/stdin_test.sh (+203/-0)
testing/unit/test_selection.py (+104/-406)
To merge this branch: bzr merge lp:~aaron-whitehouse/duplicity/filelist_combine
Reviewer Review Type Date Requested Status
duplicity-team Pending
Review via email: mp+252814@code.launchpad.net

Description of the change

Merged globbing and non-globbing filelists to use the same code path and all accept globbing characters. Added deprecation warning to the --exclude-globbing-filelist and include-globbing-filelist options in commandline.py and hid them from help output. Updated the manual (and unit tests) accordingly.

Note that this does trigger a change in behaviour for duplicity. Previously, include patterns in include-filelist did not match files in a directory that was included, so /usr/local in an include file would not have matched /usr/local/doc. Now, this folder would be included, as would occur if --include or the old --include-globbing-filelist was used. Additional lines will therefore need to be added to filelists to unambiguously exclude unwanted subfolders, if this is intended.

Mark --include-filelist-stdin and --exclude-fielist-stdin for deprecation and hide from --help output.

To post a comment you must log in.
Revision history for this message
edso (ed.so) wrote :

three point

1. wouldn't it make sense to either depreciate in-/exclude or in/exclude-globbing as they afre functional identical

2. not sure if we should want to have keep the old non-globbing selection for simple setups. easier to understand and done.

3. your branch clashes with the current dev branch. you probably need to rebase your changes.

..ede/duply.net

Revision history for this message
Kenneth Loafman (kenneth-loafman) wrote :

1. He deprecated the in/exclude-globbing-filelist and folded that
functionality into in/exclude-filelist.

2. We talked about this on the mailing list. This simplifies the number of
options we deal with and in general should make life easier. If you don't
use globbing, the selection should be simple still.

3. Yes, should have started with the current code for the merge.

On Thu, Mar 12, 2015 at 2:44 PM, edso <email address hidden> wrote:

> three point
>
> 1. wouldn't it make sense to either depreciate in-/exclude or
> in/exclude-globbing as they afre functional identical
>
> 2. not sure if we should want to have keep the old non-globbing selection
> for simple setups. easier to understand and done.
>
> 3. your branch clashes with the current dev branch. you probably need to
> rebase your changes.
>
> ..ede/duply.net
>
>
> --
>
> https://code.launchpad.net/~aaron-whitehouse/duplicity/filelist_combine/+merge/252814
> You are subscribed to branch lp:duplicity.
>

Revision history for this message
edso (ed.so) wrote :

1. so in/exclude-globbing* is retired now?

2. right, but '/folder' is different from '/folder/**' now, although they might be perceived identical by a user. why not fold the whole way and only have one globbing filelist '--filelist' parameter which uses '+/-' to identify the rows as we had them already.

the reasons are
- simplification
- with the meaning change old filelists won't work the same way as before anymore, so a complete new parameter would force users to chack what has changed

of course the change needs to be documented properly in the manpage too.

3. jepp

..ede/duply.net

1076. By Aaron Whitehouse <email address hidden>

Merge in changes to rebase against dev.

1077. By Aaron Whitehouse <email address hidden>

Updated duplicity.pot

Revision history for this message
Aaron Whitehouse (aaron-whitehouse) wrote :

Sorry about the conflict. I thought I had, but was updating against a branch instead of the dev branch - I'm still getting the hang of bzr. Next time I'll know to check the information on the merge page. Hopefully I've rebased it in the correct way, but please let me know if not.

Kenneth is right, I folded the functionality of globbing filelists into non-globbing filelists. What is called --include-filelist is what used to be --include-globbing-filelist, but I went for the shorter name. So it is the old --in/exclude-filelist functionality that has been removed.

I'm not sure that I follow your point that /folder is different from /folder/** now - do you mean that they are prior to the merge, or will be after the merge? Would you mind explaining a little further, please?

I was basing my view that there would be a functionality change on the manual, but in testing the current version (prior to this merge), I'm not sure that it works as I thought it did. The code below works on the current dev version, suggesting to me that at least in the case I've tested they are including the same things (which is all files and subfolders).

class TestOldInclude
    def test_old_style_include(self):
        """This compares a backup using --include-filelist with one using --include-globbing-filelist."""
        with open("testfiles/filelist.txt", 'w') as f:
            f.write("+ testfiles/select2\n"
                    "- testfiles/select")
        self.backup("full", "testfiles/", options=["--include-filelist=testfiles/filelist.txt"])
        self.restore()
        restore_dir = 'testfiles/restore_out'
        restored = self.directory_tree_to_list_of_lists(restore_dir + "/select2")
        self.backup("full", "testfiles/", options=["--include-globbing-filelist=testfiles/filelist.txt"])
        self.restore()
        restore_dir = 'testfiles/restore_out'
        restored2 = self.directory_tree_to_list_of_lists(restore_dir + "/select2")
        self.assertEqual(restored, restored2)
        print(restored)

I also just had a play around on my system version (0.6.21) to investigate the point from the manual:
"2. Include patterns do not match files in a directory that is included. So /usr/local in an include file will not match /usr/local/doc"

I created a test tree of:
===
usr:
clown local

usr/clown:

usr/local:
doc test1 test.txt

usr/local/doc:

usr/local/test1:
===

and a filelist of:
usr/local
- usr/clown

and ran:
duplicity --include-filelist=filelist.txt usr file://des/

On restoring it, my restore filetree is:
===
restore/:
local

restore/local:
doc test1 test.txt

restore/local/doc:

restore/local/test1:
===

So usr/local in my include file _does_ in fact include the file usr/local/doc in my backup.

Maybe I'm missing the point of what it was supposed to do differently, but obviously if it wasn't actually doing it, we don't need to worry about a functionality change. I would appreciate any thoughts that you have from your much greater knowledge of the code/project!

Revision history for this message
Kenneth Loafman (kenneth-loafman) wrote :

One of the reasons for --include / --exclude is the default handling for
non-specific names, ones without + or -, say the output of find or similar,
so I'm happy with that scenario. A lot of tools I use have similar
semantics.

One set of semantics I would like to explore is to do away with
--in/exclude-filename and go with just --in/exclude <spec> where <spec> is:
1) simple filename or directory name
2) @filename to in/exclude by filename
3) - (dash) to in/exclude by stdin

To answer edso's next proposal we could make it --filename if we went with
--filename <spec> where <spec> is like above but preceded by '+' for
inclusion and '-' for exclusion. To avoid confusion we could always drop
#3 above. I know of no use for that option in real life.

On Fri, Mar 13, 2015 at 7:22 AM, <email address hidden> wrote:

> The proposal to merge lp:~aaron-whitehouse/duplicity/filelist_combine into
> lp:duplicity has been updated.
>
> Status: Needs review => Merged
>
> For more details, see:
>
> https://code.launchpad.net/~aaron-whitehouse/duplicity/filelist_combine/+merge/252814
> --
> Your team duplicity-team is requested to review the proposed merge of
> lp:~aaron-whitehouse/duplicity/filelist_combine into lp:duplicity.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~duplicity-team
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~duplicity-team
> More help : https://help.launchpad.net/ListHelp
>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/duplicity.1'
2--- bin/duplicity.1 2015-02-08 16:43:23 +0000
3+++ bin/duplicity.1 2015-03-12 21:50:57 +0000
4@@ -481,28 +481,15 @@
5 .TP
6 .BI "--exclude-filelist " filename
7 Excludes the files listed in
8-.IR filename .
9-See the
10-.B FILE SELECTION
11-section for more information.
12-
13-.TP
14-.BI --exclude-filelist-stdin
15-Like
16-.BI --exclude-filelist,
17-but the list of files will be read from standard input. See the
18-.B FILE SELECTION
19-section for more information.
20-
21-.TP
22-.BR "--exclude-globbing-filelist " filename
23-Like
24-.BI --exclude-filelist
25-but each line of the filelist will be interpreted according to the
26+.IR filename,
27+with each line of the filelist interpreted according to the
28 same rules as
29 .BI --include
30 and
31 .BI --exclude.
32+See the
33+.B FILE SELECTION
34+section for more information.
35
36 .TP
37 .BR "--exclude-if-present " filename
38@@ -663,22 +650,6 @@
39 section for more information.
40
41 .TP
42-.BI --include-filelist-stdin
43-Like
44-.BR --include-filelist ,
45-but read the list of included files from standard input.
46-
47-.TP
48-.BI "--include-globbing-filelist " filename
49-Like
50-.BI --include-filelist
51-but each line of the filelist will be interpreted according to the
52-same rules as
53-.BI --include
54-and
55-.BI --exclude.
56-
57-.TP
58 .BI "--include-regexp " regexp
59 Include files matching the regular expression
60 .IR regexp .
61@@ -746,7 +717,7 @@
62 Use nulls (\\0) instead of newlines (\\n) as line separators, which
63 may help when dealing with filenames containing newlines. This
64 affects the expected format of the files specified by the
65---{include|exclude}-filelist[-stdin] switches as well as the format of
66+--{include|exclude}-filelist switches as well as the format of
67 the directory statistics file.
68
69 .TP
70@@ -1337,10 +1308,6 @@
71 "03-05-2002", and "2002-3-05" all mean March 5th, 2002.
72
73 .SH FILE SELECTION
74-duplicity accepts the same file selection options
75-.B rdiff-backup
76-does, including --exclude, --exclude-filelist-stdin, etc.
77-
78 When duplicity is run, it searches through the given source
79 directory and backs up all the files specified by the file selection
80 system. The file selection system comprises a number of file
81@@ -1353,20 +1320,12 @@
82 .br
83 --exclude-filelist
84 .br
85---exclude-filelist-stdin
86-.br
87---exclude-globbing-filelist
88-.br
89 --exclude-regexp
90 .br
91 --include
92 .br
93 --include-filelist
94 .br
95---include-filelist-stdin
96-.br
97---include-globbing-filelist
98-.br
99 --include-regexp
100 .RE
101 Each file selection condition either matches or doesn't match a given
102@@ -1402,9 +1361,9 @@
103 The
104 .BR include ,
105 .BR exclude ,
106-.BR include-globbing-filelist ,
107+.BR include-filelist ,
108 and
109-.B exclude-globbing-filelist
110+.B exclude-filelist
111 options accept some
112 .IR "extended shell globbing patterns" .
113 These patterns can contain
114@@ -1493,34 +1452,18 @@
115
116 The
117 .BR --include-filelist ,
118-.BR --exclude-filelist ,
119-.BR --include-filelist-stdin ,
120 and
121-.BI --exclude-filelist-stdin
122+.BI --exclude-filelist ,
123 options also introduce file selection conditions. They direct
124 duplicity to read in a file, each line of which is a file
125 specification, and to include or exclude the matching files. Lines
126 are separated by newlines or nulls, depending on whether the
127---null-separator switch was given. Each line in a filelist is
128-interpreted similarly to the way
129-.I extended shell patterns
130-are, with a few exceptions:
131-.PP
132-.B 1.
133-Globbing patterns like
134-.BR * ,
135-.BR ** ,
136-.BR ? ,
137+--null-separator switch was given. Each line in the filelist will be
138+interpreted as a globbing pattern the way
139+.BI --include
140 and
141-.B [...]
142-are not expanded.
143-.br
144-.B 2.
145-Include patterns do not match files in a directory that is included.
146-So /usr/local in an include file will not match /usr/local/doc.
147-.br
148-.B 3.
149-Lines starting with "+ " are interpreted as include directives, even
150+.BI --exclude
151+options are interpreted, except that lines starting with "+ " are interpreted as include directives, even
152 if found in a filelist referenced by
153 .BR --exclude-filelist .
154 Similarly, lines starting with "- " exclude files even if they are
155@@ -1544,23 +1487,18 @@
156 .B "--include-filelist list.txt"
157 would include /usr, /usr/local, and
158 /usr/local/bin. It would exclude /usr/local/doc,
159-/usr/local/doc/python, etc. It neither excludes nor includes
160-/usr/local/man, leaving the fate of this directory to the next
161-specification condition. Finally, it is undefined what happens with
162+/usr/local/doc/python, etc. It would also include
163+/usr/local/man, as this is included within /user/local. Finally, it is undefined what happens with
164 /var. A single file list should not contain conflicting file
165 specifications.
166
167-The
168-.BI --include-globbing-filelist
169-and
170-.BI --exclude-globbing-filelist
171-options also specify filelists, but each line in the filelist will be
172+Each line in the filelist will also be
173 interpreted as a globbing pattern the way
174 .BI --include
175 and
176 .BI --exclude
177-options are interpreted (although "+ " and "- " prefixing is still
178-allowed). For instance, if the file "globbing-list.txt" contains the
179+options are interpreted.
180+For instance, if the file "list.txt" contains the
181 lines:
182
183 .RS
184@@ -1572,7 +1510,7 @@
185 .RE
186
187 Then
188-.B "--include-globbing-filelist globbing-list.txt"
189+.B "--include-filelist list.txt"
190 would be exactly the same as specifying
191 .B "--include dir/foo --include dir/bar --exclude **"
192 on the command line.
193
194=== modified file 'duplicity/commandline.py'
195--- duplicity/commandline.py 2015-01-31 23:30:49 +0000
196+++ duplicity/commandline.py 2015-03-12 21:50:57 +0000
197@@ -73,6 +73,21 @@
198 "Use of default filenames is strongly suggested.") % opt,
199 log.ERROR, force_print=True)
200
201+def old_globbing_filelist_deprecation(opt):
202+ log.Log(_("Warning: Option %s is pending deprecation and will be removed in a future release.\n"
203+ "--include-filelist and --exclude-filelist now accept globbing characters and should "
204+ "be used instead.") % opt,
205+ log.ERROR, force_print=True)
206+
207+def stdin_deprecation(opt):
208+ # See https://bugs.launchpad.net/duplicity/+bug/1423367
209+ # In almost all Linux distros stdin is a file represented by /dev/stdin,
210+ # so --exclude-file=/dev/stdin will work as a substitute.
211+ log.Log(_("Warning: Option %s is pending deprecation and will be removed in a future release.\n"
212+ "On many GNU/Linux systems, stdin is represented by /dev/stdin and\n"
213+ "--include-filelist=/dev/stdin or --exclude-filelist=/dev/stdin could\n"
214+ "be used as a substitute.") % opt,
215+ log.ERROR, force_print=True)
216
217 def expand_fn(filename):
218 return os.path.expanduser(os.path.expandvars(filename))
219@@ -307,10 +322,14 @@
220
221 parser.add_option("--exclude-filelist-stdin", action="callback", dest="",
222 callback=lambda o, s, v, p: (select_opts.append(("--exclude-filelist", "standard input")),
223- select_files.append(sys.stdin)))
224+ select_files.append(sys.stdin),
225+ stdin_deprecation(o)),
226+ help=optparse.SUPPRESS_HELP)
227
228 parser.add_option("--exclude-globbing-filelist", type="file", metavar=_("filename"),
229- dest="", action="callback", callback=add_filelist)
230+ dest="", action="callback", callback=lambda o, s, v, p: (add_filelist(o, s, v, p),
231+ old_globbing_filelist_deprecation(s)),
232+ help=optparse.SUPPRESS_HELP)
233
234 # TRANSL: Used in usage help to represent the name of a file. Example:
235 # --log-file <filename>
236@@ -409,9 +428,13 @@
237 dest="", action="callback", callback=add_filelist)
238 parser.add_option("--include-filelist-stdin", action="callback", dest="",
239 callback=lambda o, s, v, p: (select_opts.append(("--include-filelist", "standard input")),
240- select_files.append(sys.stdin)))
241+ select_files.append(sys.stdin),
242+ stdin_deprecation(o)),
243+ help=optparse.SUPPRESS_HELP)
244 parser.add_option("--include-globbing-filelist", type="file", metavar=_("filename"),
245- dest="", action="callback", callback=add_filelist)
246+ dest="", action="callback", callback=lambda o, s, v, p: (add_filelist(o, s, v, p),
247+ old_globbing_filelist_deprecation(s)),
248+ help=optparse.SUPPRESS_HELP)
249 parser.add_option("--include-regexp", metavar=_("regular_expression"), dest="",
250 type="string", action="callback", callback=add_selection)
251
252
253=== modified file 'duplicity/selection.py'
254--- duplicity/selection.py 2015-01-31 23:30:49 +0000
255+++ duplicity/selection.py 2015-03-12 21:50:57 +0000
256@@ -102,6 +102,7 @@
257
258 def set_iter(self):
259 """Initialize generator, prepare to iterate."""
260+ # Externally-accessed method
261 self.rootpath.setdata() # this may have changed since Select init
262 self.iter = self.Iterate(self.rootpath)
263 self.next = self.iter.next
264@@ -117,6 +118,7 @@
265 scanning" bit.
266
267 """
268+ # Only called by set_iter. Internal.
269 def error_handler(exc, path, filename):
270 fullpath = os.path.join(path.name, filename)
271 try:
272@@ -143,6 +145,7 @@
273 and should be included iff something inside is included.
274
275 """
276+ # Only called by Iterate. Internal.
277 # todo: get around circular dependency issue by importing here
278 from duplicity import robust # @Reimport
279 for filename in robust.listpath(path):
280@@ -200,6 +203,7 @@
281
282 def Select(self, path):
283 """Run through the selection functions and return dominant val 0/1/2"""
284+ # Only used by diryield and tests. Internal.
285 if not self.selection_functions:
286 return 1
287 scan_pending = False
288@@ -227,6 +231,7 @@
289 (option-string, (additional argument, filelist_fp)).
290
291 """
292+ # Called by commandline.py set_selection. External.
293 filelists_index = 0
294 try:
295 for opt, arg in argtuples:
296@@ -236,11 +241,9 @@
297 self.add_selection_func(self.present_get_sf(arg, 0))
298 elif opt == "--exclude-device-files":
299 self.add_selection_func(self.devfiles_get_sf())
300- elif opt == "--exclude-filelist":
301- self.add_selection_func(self.filelist_get_sf(
302- filelists[filelists_index], 0, arg))
303- filelists_index += 1
304- elif opt == "--exclude-globbing-filelist":
305+ elif (opt == "--exclude-filelist") or (opt == "--exclude-globbing-filelist"):
306+ # --exclude-globbing-filelist is now deprecated, as all filelists are globbing
307+ # but keep this here for the short term for backwards-compatibility
308 for sf in self.filelist_globbing_get_sfs(filelists[filelists_index], 0, arg):
309 self.add_selection_func(sf)
310 filelists_index += 1
311@@ -252,11 +255,9 @@
312 self.add_selection_func(self.exclude_older_get_sf(arg))
313 elif opt == "--include":
314 self.add_selection_func(self.glob_get_sf(arg, 1))
315- elif opt == "--include-filelist":
316- self.add_selection_func(self.filelist_get_sf(
317- filelists[filelists_index], 1, arg))
318- filelists_index += 1
319- elif opt == "--include-globbing-filelist":
320+ elif (opt == "--include-filelist") or (opt == "--include-globbing-filelist"):
321+ # --include-globbing-filelist is now deprecated, as all filelists are globbing
322+ # but keep this here for the short term for backwards-compatibility
323 for sf in self.filelist_globbing_get_sfs(filelists[filelists_index], 1, arg):
324 self.add_selection_func(sf)
325 filelists_index += 1
326@@ -271,6 +272,7 @@
327
328 def parse_catch_error(self, exc):
329 """Deal with selection error exc"""
330+ # Internal, used by ParseArgs.
331 if isinstance(exc, FilePrefixError):
332 log.FatalError(_("""\
333 Fatal Error: The file specification
334@@ -288,6 +290,7 @@
335
336 def parse_last_excludes(self):
337 """Exit with error if last selection function isn't an exclude"""
338+ # Internal. Used by ParseArgs.
339 if (self.selection_functions and
340 not self.selection_functions[-1].exclude):
341 log.FatalError(_("""\
342@@ -301,76 +304,12 @@
343
344 def add_selection_func(self, sel_func, add_to_start=None):
345 """Add another selection function at the end or beginning"""
346+ # Internal. Used by ParseArgs.
347 if add_to_start:
348 self.selection_functions.insert(0, sel_func)
349 else:
350 self.selection_functions.append(sel_func)
351
352- def filelist_get_sf(self, filelist_fp, inc_default, filelist_name):
353- """Return selection function by reading list of files
354-
355- The format of the filelist is documented in the man page.
356- filelist_fp should be an (open) file object.
357- inc_default should be true if this is an include list,
358- false for an exclude list.
359- filelist_name is just a string used for logging.
360-
361- """
362- log.Notice(_("Reading filelist %s") % filelist_name)
363- tuple_list, something_excluded = \
364- self.filelist_read(filelist_fp, inc_default, filelist_name)
365- log.Notice(_("Sorting filelist %s") % filelist_name)
366- tuple_list.sort()
367- i = [0] # We have to put index in list because of stupid scoping rules
368-
369- def selection_function(path):
370- while 1:
371- if i[0] >= len(tuple_list):
372- return None
373- include, move_on = \
374- self.filelist_pair_match(path, tuple_list[i[0]])
375- if move_on:
376- i[0] += 1
377- if include is None:
378- continue # later line may match
379- return include
380-
381- selection_function.exclude = something_excluded or inc_default == 0
382- selection_function.name = "Filelist: " + filelist_name
383- return selection_function
384-
385- def filelist_read(self, filelist_fp, include, filelist_name):
386- """Read filelist from fp, return (tuplelist, something_excluded)"""
387- prefix_warnings = [0]
388-
389- def incr_warnings(exc):
390- """Warn if prefix is incorrect"""
391- prefix_warnings[0] += 1
392- if prefix_warnings[0] < 6:
393- log.Warn(_("Warning: file specification '%s' in filelist %s\n"
394- "doesn't start with correct prefix %s. Ignoring.") %
395- (exc, filelist_name, util.ufn(self.prefix)))
396- if prefix_warnings[0] == 5:
397- log.Warn(_("Future prefix errors will not be logged."))
398-
399- something_excluded, tuple_list = None, []
400- separator = globals.null_separator and "\0" or "\n"
401- for line in filelist_fp.read().split(separator):
402- try:
403- tuple = self.filelist_parse_line(line, include)
404- except FilePrefixError as exc:
405- incr_warnings(exc)
406- continue
407- if not tuple:
408- # Skip blanks/full-line comments
409- continue
410- else:
411- tuple_list.append(tuple)
412- if not tuple[1]:
413- something_excluded = 1
414- if filelist_fp not in (sys.stdin,) and filelist_fp.close():
415- log.Warn(_("Error closing filelist %s") % filelist_name)
416- return (tuple_list, something_excluded)
417
418 def filelist_sanitise_line(self, line, include_default):
419 """
420@@ -379,6 +318,7 @@
421 The aim is to parse filelists in a consistent way, prior to the interpretation of globbing statements.
422 The function removes whitespace, comment lines and processes modifiers (leading +/-) and quotes.
423 """
424+ # Internal. Used by filelist_globbing_get_sfs
425
426 line = line.strip()
427 if not line: # skip blanks
428@@ -400,59 +340,6 @@
429
430 return line, include
431
432- def filelist_parse_line(self, line, include):
433- """Parse a single line of a filelist, returning a pair or None if the line is blank/a comment
434-
435- Pair will be of form (index, include), where index is another
436- tuple, and include is 1 if the line specifies that we are
437- including a file. The default is given as an argument.
438- prefix is the string that the index is relative to.
439-
440- """
441-
442- line, include = self.filelist_sanitise_line(line, include)
443-
444- if not line:
445- # Skip blanks and comments
446- return None
447-
448- if not line.startswith(self.prefix):
449- raise FilePrefixError(line)
450- line = line[len(self.prefix):] # Discard prefix
451- index = tuple(filter(lambda x: x, line.split("/"))) # remove empties
452- return (index, include)
453-
454- def filelist_pair_match(self, path, pair):
455- """Matches a filelist tuple against a path
456-
457- Returns a pair (include, move_on). include is None if the
458- tuple doesn't match either way, and 0/1 if the tuple excludes
459- or includes the path.
460-
461- move_on is true if the tuple cannot match a later index, and
462- so we should move on to the next tuple in the index.
463-
464- """
465- index, include = pair
466- if include == 1:
467- if index < path.index:
468- return (None, True)
469- if index == path.index:
470- return (1, True)
471- elif index[:len(path.index)] == path.index:
472- return (1, False) # /foo/bar implicitly includes /foo
473- else:
474- return (None, False) # path greater, not initial sequence
475- elif include == 0:
476- if path.index[:len(index)] == index:
477- return (0, False) # /foo implicitly excludes /foo/bar
478- elif index < path.index:
479- return (None, True)
480- else:
481- return (None, False) # path greater, not initial sequence
482- else:
483- assert 0, "Include is %s, should be 0 or 1" % (include,)
484-
485 def filelist_globbing_get_sfs(self, filelist_fp, inc_default, list_name):
486 """Return list of selection functions by reading fileobj
487
488@@ -462,6 +349,7 @@
489 See the man page on --[include/exclude]-globbing-filelist
490
491 """
492+ # Internal. Used by ParseArgs.
493 log.Notice(_("Reading globbing filelist %s") % list_name)
494 separator = globals.null_separator and "\0" or "\n"
495 for line in filelist_fp.read().split(separator):
496@@ -473,6 +361,7 @@
497
498 def other_filesystems_get_sf(self, include):
499 """Return selection function matching files on other filesystems"""
500+ # Internal. Used by ParseArgs and unit tests.
501 assert include == 0 or include == 1
502 root_devloc = self.rootpath.getdevloc()
503
504@@ -488,6 +377,7 @@
505
506 def regexp_get_sf(self, regexp_string, include):
507 """Return selection function given by regexp_string"""
508+ # Internal. Used by ParseArgs and unit tests.
509 assert include == 0 or include == 1
510 try:
511 regexp = re.compile(regexp_string)
512@@ -507,6 +397,7 @@
513
514 def devfiles_get_sf(self):
515 """Return a selection function to exclude all dev files"""
516+ # Internal. Used by ParseArgs.
517 if self.selection_functions:
518 log.Warn(_("Warning: exclude-device-files is not the first "
519 "selector.\nThis may not be what you intended"))
520@@ -523,6 +414,7 @@
521
522 def glob_get_sf(self, glob_str, include):
523 """Return selection function given by glob string"""
524+ # Internal. Used by ParseArgs, filelist_globbing_get_sfs and unit tests.
525 assert include == 0 or include == 1
526 if glob_str == "**":
527 sel_func = lambda path: include
528@@ -539,6 +431,7 @@
529
530 def present_get_sf(self, filename, include):
531 """Return selection function given by existence of a file in a directory"""
532+ # Internal. Used by ParseArgs.
533 assert include == 0 or include == 1
534
535 def exclude_sel_func(path):
536@@ -572,6 +465,7 @@
537 globbing characters are used.
538
539 """
540+ # Internal. Used by glob_get_sf and unit tests.
541 if not filename.startswith(self.prefix):
542 raise FilePrefixError(filename)
543 index = tuple(filter(lambda x: x,
544@@ -580,6 +474,7 @@
545
546 def glob_get_tuple_sf(self, tuple, include):
547 """Return selection function based on tuple"""
548+ # Internal. Used by glob_get_filename_sf.
549 def include_sel_func(path):
550 if (path.index == tuple[:len(path.index)] or
551 path.index[:len(tuple)] == tuple):
552@@ -616,6 +511,7 @@
553 things similar to this.
554
555 """
556+ # Internal. Used by glob_get_sf and unit tests.
557 if glob_str.lower().startswith("ignorecase:"):
558 re_comp = lambda r: re.compile(r, re.I | re.S)
559 glob_str = glob_str[len("ignorecase:"):]
560@@ -656,6 +552,7 @@
561
562 def exclude_older_get_sf(self, date):
563 """Return selection function based on files older than modification date """
564+ # Internal. Used by ParseArgs.
565
566 def sel_func(path):
567 if not path.isreg():
568@@ -673,6 +570,7 @@
569
570 def glob_get_prefix_res(self, glob_str):
571 """Return list of regexps equivalent to prefixes of glob_str"""
572+ # Internal. Used by glob_get_normal_sf.
573 glob_parts = glob_str.split("/")
574 if "" in glob_parts[1:-1]:
575 # "" OK if comes first or last, as in /foo/
576@@ -696,6 +594,7 @@
577 by Donovan Baarda.
578
579 """
580+ # Internal. Used by glob_get_normal_sf, glob_get_prefix_res and unit tests.
581 i, n, res = 0, len(pat), ''
582 while i < n:
583 c, s = pat[i], pat[i:i + 2]
584
585=== modified file 'po/duplicity.pot'
586--- po/duplicity.pot 2015-03-11 12:27:42 +0000
587+++ po/duplicity.pot 2015-03-12 21:50:57 +0000
588@@ -8,7 +8,7 @@
589 msgstr ""
590 "Project-Id-Version: PACKAGE VERSION\n"
591 "Report-Msgid-Bugs-To: Kenneth Loafman <kenneth@loafman.com>\n"
592-"POT-Creation-Date: 2015-03-11 07:21-0500\n"
593+"POT-Creation-Date: 2015-03-12 21:43+0000\n"
594 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
595 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
596 "Language-Team: LANGUAGE <LL@li.org>\n"
597@@ -371,7 +371,7 @@
598 msgid "Backend error detail: %s"
599 msgstr ""
600
601-#: ../bin/rdiffdir:61 ../duplicity/commandline.py:241
602+#: ../bin/rdiffdir:61 ../duplicity/commandline.py:256
603 #, python-format
604 msgid "Error opening file %s"
605 msgstr ""
606@@ -693,11 +693,30 @@
607 "Use of default filenames is strongly suggested."
608 msgstr ""
609
610+#: ../duplicity/commandline.py:77
611+#, python-format
612+msgid ""
613+"Warning: Option %s is pending deprecation and will be removed in a future "
614+"release.\n"
615+"--include-filelist and --exclude-filelist now accept globbing characters and "
616+"should be used instead."
617+msgstr ""
618+
619+#: ../duplicity/commandline.py:86
620+#, python-format
621+msgid ""
622+"Warning: Option %s is pending deprecation and will be removed in a future "
623+"release.\n"
624+"On many GNU/Linux systems, stdin is represented by /dev/stdin and\n"
625+"--include-filelist=/dev/stdin or --exclude-filelist=/dev/stdin could\n"
626+"be used as a substitute."
627+msgstr ""
628+
629 #. Used in usage help to represent a Unix-style path name. Example:
630 #. --archive-dir <path>
631-#: ../duplicity/commandline.py:262 ../duplicity/commandline.py:272
632-#: ../duplicity/commandline.py:289 ../duplicity/commandline.py:359
633-#: ../duplicity/commandline.py:560 ../duplicity/commandline.py:774
634+#: ../duplicity/commandline.py:277 ../duplicity/commandline.py:287
635+#: ../duplicity/commandline.py:304 ../duplicity/commandline.py:378
636+#: ../duplicity/commandline.py:583 ../duplicity/commandline.py:797
637 msgid "path"
638 msgstr ""
639
640@@ -707,9 +726,9 @@
641 #. --hidden-encrypt-key <gpg_key_id>
642 #. Used in usage help to represent an ID for a GnuPG key. Example:
643 #. --encrypt-key <gpg_key_id>
644-#: ../duplicity/commandline.py:284 ../duplicity/commandline.py:291
645-#: ../duplicity/commandline.py:381 ../duplicity/commandline.py:544
646-#: ../duplicity/commandline.py:747
647+#: ../duplicity/commandline.py:299 ../duplicity/commandline.py:306
648+#: ../duplicity/commandline.py:400 ../duplicity/commandline.py:567
649+#: ../duplicity/commandline.py:770
650 msgid "gpg-key-id"
651 msgstr ""
652
653@@ -717,43 +736,43 @@
654 #. matching one or more files, as described in the documentation.
655 #. Example:
656 #. --exclude <shell_pattern>
657-#: ../duplicity/commandline.py:299 ../duplicity/commandline.py:406
658-#: ../duplicity/commandline.py:797
659+#: ../duplicity/commandline.py:314 ../duplicity/commandline.py:425
660+#: ../duplicity/commandline.py:820
661 msgid "shell_pattern"
662 msgstr ""
663
664 #. Used in usage help to represent the name of a file. Example:
665 #. --log-file <filename>
666-#: ../duplicity/commandline.py:305 ../duplicity/commandline.py:312
667-#: ../duplicity/commandline.py:317 ../duplicity/commandline.py:408
668-#: ../duplicity/commandline.py:413 ../duplicity/commandline.py:424
669-#: ../duplicity/commandline.py:743
670+#: ../duplicity/commandline.py:320 ../duplicity/commandline.py:329
671+#: ../duplicity/commandline.py:336 ../duplicity/commandline.py:427
672+#: ../duplicity/commandline.py:434 ../duplicity/commandline.py:447
673+#: ../duplicity/commandline.py:766
674 msgid "filename"
675 msgstr ""
676
677 #. Used in usage help to represent a regular expression (regexp).
678-#: ../duplicity/commandline.py:324 ../duplicity/commandline.py:415
679+#: ../duplicity/commandline.py:343 ../duplicity/commandline.py:438
680 msgid "regular_expression"
681 msgstr ""
682
683 #. Used in usage help to represent a time spec for a previous
684 #. point in time, as described in the documentation. Example:
685 #. duplicity remove-older-than time [options] target_url
686-#: ../duplicity/commandline.py:328 ../duplicity/commandline.py:371
687-#: ../duplicity/commandline.py:486 ../duplicity/commandline.py:829
688+#: ../duplicity/commandline.py:347 ../duplicity/commandline.py:390
689+#: ../duplicity/commandline.py:509 ../duplicity/commandline.py:852
690 msgid "time"
691 msgstr ""
692
693 #. Used in usage help. (Should be consistent with the "Options:"
694 #. header.) Example:
695 #. duplicity [full|incremental] [options] source_dir target_url
696-#: ../duplicity/commandline.py:377 ../duplicity/commandline.py:466
697-#: ../duplicity/commandline.py:489 ../duplicity/commandline.py:552
698-#: ../duplicity/commandline.py:762
699+#: ../duplicity/commandline.py:396 ../duplicity/commandline.py:489
700+#: ../duplicity/commandline.py:512 ../duplicity/commandline.py:575
701+#: ../duplicity/commandline.py:785
702 msgid "options"
703 msgstr ""
704
705-#: ../duplicity/commandline.py:392
706+#: ../duplicity/commandline.py:411
707 #, python-format
708 msgid ""
709 "Running in 'ignore errors' mode due to %s; please re-consider if this was "
710@@ -761,152 +780,152 @@
711 msgstr ""
712
713 #. Used in usage help to represent an imap mailbox
714-#: ../duplicity/commandline.py:404
715+#: ../duplicity/commandline.py:423
716 msgid "imap_mailbox"
717 msgstr ""
718
719-#: ../duplicity/commandline.py:418
720+#: ../duplicity/commandline.py:441
721 msgid "file_descriptor"
722 msgstr ""
723
724 #. Used in usage help to represent a desired number of
725 #. something. Example:
726 #. --num-retries <number>
727-#: ../duplicity/commandline.py:429 ../duplicity/commandline.py:451
728-#: ../duplicity/commandline.py:463 ../duplicity/commandline.py:472
729-#: ../duplicity/commandline.py:510 ../duplicity/commandline.py:515
730-#: ../duplicity/commandline.py:519 ../duplicity/commandline.py:588
731-#: ../duplicity/commandline.py:757
732+#: ../duplicity/commandline.py:452 ../duplicity/commandline.py:474
733+#: ../duplicity/commandline.py:486 ../duplicity/commandline.py:495
734+#: ../duplicity/commandline.py:533 ../duplicity/commandline.py:538
735+#: ../duplicity/commandline.py:542 ../duplicity/commandline.py:611
736+#: ../duplicity/commandline.py:780
737 msgid "number"
738 msgstr ""
739
740 #. Used in usage help (noun)
741-#: ../duplicity/commandline.py:432
742+#: ../duplicity/commandline.py:455
743 msgid "backup name"
744 msgstr ""
745
746 #. noun
747-#: ../duplicity/commandline.py:528 ../duplicity/commandline.py:531
748-#: ../duplicity/commandline.py:728
749+#: ../duplicity/commandline.py:551 ../duplicity/commandline.py:554
750+#: ../duplicity/commandline.py:751
751 msgid "command"
752 msgstr ""
753
754-#: ../duplicity/commandline.py:534
755+#: ../duplicity/commandline.py:557
756 msgid "pyrax|cloudfiles"
757 msgstr ""
758
759-#: ../duplicity/commandline.py:555
760+#: ../duplicity/commandline.py:578
761 msgid "pem formatted bundle of certificate authorities"
762 msgstr ""
763
764 #. Used in usage help. Example:
765 #. --timeout <seconds>
766-#: ../duplicity/commandline.py:565 ../duplicity/commandline.py:791
767+#: ../duplicity/commandline.py:588 ../duplicity/commandline.py:814
768 msgid "seconds"
769 msgstr ""
770
771 #. abbreviation for "character" (noun)
772-#: ../duplicity/commandline.py:571 ../duplicity/commandline.py:725
773+#: ../duplicity/commandline.py:594 ../duplicity/commandline.py:748
774 msgid "char"
775 msgstr ""
776
777-#: ../duplicity/commandline.py:691
778+#: ../duplicity/commandline.py:714
779 #, python-format
780 msgid "Using archive dir: %s"
781 msgstr ""
782
783-#: ../duplicity/commandline.py:692
784+#: ../duplicity/commandline.py:715
785 #, python-format
786 msgid "Using backup name: %s"
787 msgstr ""
788
789-#: ../duplicity/commandline.py:699
790+#: ../duplicity/commandline.py:722
791 #, python-format
792 msgid "Command line error: %s"
793 msgstr ""
794
795-#: ../duplicity/commandline.py:700
796+#: ../duplicity/commandline.py:723
797 msgid "Enter 'duplicity --help' for help screen."
798 msgstr ""
799
800 #. Used in usage help to represent a Unix-style path name. Example:
801 #. rsync://user[:password]@other_host[:port]//absolute_path
802-#: ../duplicity/commandline.py:713
803+#: ../duplicity/commandline.py:736
804 msgid "absolute_path"
805 msgstr ""
806
807 #. Used in usage help. Example:
808 #. tahoe://alias/some_dir
809-#: ../duplicity/commandline.py:717
810+#: ../duplicity/commandline.py:740
811 msgid "alias"
812 msgstr ""
813
814 #. Used in help to represent a "bucket name" for Amazon Web
815 #. Services' Simple Storage Service (S3). Example:
816 #. s3://other.host/bucket_name[/prefix]
817-#: ../duplicity/commandline.py:722
818+#: ../duplicity/commandline.py:745
819 msgid "bucket_name"
820 msgstr ""
821
822 #. Used in usage help to represent the name of a container in
823 #. Amazon Web Services' Cloudfront. Example:
824 #. cf+http://container_name
825-#: ../duplicity/commandline.py:733
826+#: ../duplicity/commandline.py:756
827 msgid "container_name"
828 msgstr ""
829
830 #. noun
831-#: ../duplicity/commandline.py:736
832+#: ../duplicity/commandline.py:759
833 msgid "count"
834 msgstr ""
835
836 #. Used in usage help to represent the name of a file directory
837-#: ../duplicity/commandline.py:739
838+#: ../duplicity/commandline.py:762
839 msgid "directory"
840 msgstr ""
841
842 #. Used in usage help, e.g. to represent the name of a code
843 #. module. Example:
844 #. rsync://user[:password]@other.host[:port]::/module/some_dir
845-#: ../duplicity/commandline.py:752
846+#: ../duplicity/commandline.py:775
847 msgid "module"
848 msgstr ""
849
850 #. Used in usage help to represent an internet hostname. Example:
851 #. ftp://user[:password]@other.host[:port]/some_dir
852-#: ../duplicity/commandline.py:766
853+#: ../duplicity/commandline.py:789
854 msgid "other.host"
855 msgstr ""
856
857 #. Used in usage help. Example:
858 #. ftp://user[:password]@other.host[:port]/some_dir
859-#: ../duplicity/commandline.py:770
860+#: ../duplicity/commandline.py:793
861 msgid "password"
862 msgstr ""
863
864 #. Used in usage help to represent a TCP port number. Example:
865 #. ftp://user[:password]@other.host[:port]/some_dir
866-#: ../duplicity/commandline.py:778
867+#: ../duplicity/commandline.py:801
868 msgid "port"
869 msgstr ""
870
871 #. Used in usage help. This represents a string to be used as a
872 #. prefix to names for backup files created by Duplicity. Example:
873 #. s3://other.host/bucket_name[/prefix]
874-#: ../duplicity/commandline.py:783
875+#: ../duplicity/commandline.py:806
876 msgid "prefix"
877 msgstr ""
878
879 #. Used in usage help to represent a Unix-style path name. Example:
880 #. rsync://user[:password]@other.host[:port]/relative_path
881-#: ../duplicity/commandline.py:787
882+#: ../duplicity/commandline.py:810
883 msgid "relative_path"
884 msgstr ""
885
886 #. Used in usage help to represent the name of a single file
887 #. directory or a Unix-style path to a directory. Example:
888 #. file:///some_dir
889-#: ../duplicity/commandline.py:802
890+#: ../duplicity/commandline.py:825
891 msgid "some_dir"
892 msgstr ""
893
894@@ -914,14 +933,14 @@
895 #. directory or a Unix-style path to a directory where files will be
896 #. coming FROM. Example:
897 #. duplicity [full|incremental] [options] source_dir target_url
898-#: ../duplicity/commandline.py:808
899+#: ../duplicity/commandline.py:831
900 msgid "source_dir"
901 msgstr ""
902
903 #. Used in usage help to represent a URL files will be coming
904 #. FROM. Example:
905 #. duplicity [restore] [options] source_url target_dir
906-#: ../duplicity/commandline.py:813
907+#: ../duplicity/commandline.py:836
908 msgid "source_url"
909 msgstr ""
910
911@@ -929,75 +948,75 @@
912 #. directory or a Unix-style path to a directory. where files will be
913 #. going TO. Example:
914 #. duplicity [restore] [options] source_url target_dir
915-#: ../duplicity/commandline.py:819
916+#: ../duplicity/commandline.py:842
917 msgid "target_dir"
918 msgstr ""
919
920 #. Used in usage help to represent a URL files will be going TO.
921 #. Example:
922 #. duplicity [full|incremental] [options] source_dir target_url
923-#: ../duplicity/commandline.py:824
924+#: ../duplicity/commandline.py:847
925 msgid "target_url"
926 msgstr ""
927
928 #. Used in usage help to represent a user name (i.e. login).
929 #. Example:
930 #. ftp://user[:password]@other.host[:port]/some_dir
931-#: ../duplicity/commandline.py:834
932+#: ../duplicity/commandline.py:857
933 msgid "user"
934 msgstr ""
935
936 #. Header in usage help
937-#: ../duplicity/commandline.py:852
938+#: ../duplicity/commandline.py:875
939 msgid "Backends and their URL formats:"
940 msgstr ""
941
942 #. Header in usage help
943-#: ../duplicity/commandline.py:881
944+#: ../duplicity/commandline.py:904
945 msgid "Commands:"
946 msgstr ""
947
948-#: ../duplicity/commandline.py:905
949+#: ../duplicity/commandline.py:928
950 #, python-format
951 msgid "Specified archive directory '%s' does not exist, or is not a directory"
952 msgstr ""
953
954-#: ../duplicity/commandline.py:914
955+#: ../duplicity/commandline.py:937
956 #, python-format
957 msgid ""
958 "Sign key should be an 8, 16 alt. 40 character hex string, like 'AA0E73D2'.\n"
959 "Received '%s' instead."
960 msgstr ""
961
962-#: ../duplicity/commandline.py:974
963+#: ../duplicity/commandline.py:997
964 #, python-format
965 msgid ""
966 "Restore destination directory %s already exists.\n"
967 "Will not overwrite."
968 msgstr ""
969
970-#: ../duplicity/commandline.py:979
971+#: ../duplicity/commandline.py:1002
972 #, python-format
973 msgid "Verify directory %s does not exist"
974 msgstr ""
975
976-#: ../duplicity/commandline.py:985
977+#: ../duplicity/commandline.py:1008
978 #, python-format
979 msgid "Backup source directory %s does not exist."
980 msgstr ""
981
982-#: ../duplicity/commandline.py:1016
983+#: ../duplicity/commandline.py:1039
984 #, python-format
985 msgid "Command line warning: %s"
986 msgstr ""
987
988-#: ../duplicity/commandline.py:1016
989+#: ../duplicity/commandline.py:1039
990 msgid ""
991 "Selection options --exclude/--include\n"
992 "currently work only when backing up,not restoring."
993 msgstr ""
994
995-#: ../duplicity/commandline.py:1064
996+#: ../duplicity/commandline.py:1087
997 #, python-format
998 msgid ""
999 "Bad URL '%s'.\n"
1000@@ -1005,7 +1024,7 @@
1001 "\"file:///usr/local\". See the man page for more information."
1002 msgstr ""
1003
1004-#: ../duplicity/commandline.py:1089
1005+#: ../duplicity/commandline.py:1112
1006 msgid "Main action: "
1007 msgstr ""
1008
1009@@ -1240,33 +1259,33 @@
1010 msgid "Error listing directory %s"
1011 msgstr ""
1012
1013-#: ../duplicity/selection.py:125
1014+#: ../duplicity/selection.py:127
1015 #, python-format
1016 msgid "Skipping socket %s"
1017 msgstr ""
1018
1019-#: ../duplicity/selection.py:129
1020+#: ../duplicity/selection.py:131
1021 #, python-format
1022 msgid "Error initializing file %s"
1023 msgstr ""
1024
1025-#: ../duplicity/selection.py:133 ../duplicity/selection.py:154
1026+#: ../duplicity/selection.py:135 ../duplicity/selection.py:157
1027 #, python-format
1028 msgid "Error accessing possibly locked file %s"
1029 msgstr ""
1030
1031-#: ../duplicity/selection.py:169
1032+#: ../duplicity/selection.py:172
1033 #, python-format
1034 msgid "Warning: base %s doesn't exist, continuing"
1035 msgstr ""
1036
1037-#: ../duplicity/selection.py:172 ../duplicity/selection.py:190
1038-#: ../duplicity/selection.py:193
1039+#: ../duplicity/selection.py:175 ../duplicity/selection.py:193
1040+#: ../duplicity/selection.py:196
1041 #, python-format
1042 msgid "Selecting %s"
1043 msgstr ""
1044
1045-#: ../duplicity/selection.py:275
1046+#: ../duplicity/selection.py:277
1047 #, python-format
1048 msgid ""
1049 "Fatal Error: The file specification\n"
1050@@ -1277,14 +1296,14 @@
1051 "pattern (such as '**') which matches the base directory."
1052 msgstr ""
1053
1054-#: ../duplicity/selection.py:284
1055+#: ../duplicity/selection.py:286
1056 #, python-format
1057 msgid ""
1058 "Fatal Error while processing expression\n"
1059 "%s"
1060 msgstr ""
1061
1062-#: ../duplicity/selection.py:293
1063+#: ../duplicity/selection.py:296
1064 #, python-format
1065 msgid ""
1066 "Last selection expression:\n"
1067@@ -1294,43 +1313,17 @@
1068 "probably isn't what you meant."
1069 msgstr ""
1070
1071-#: ../duplicity/selection.py:319
1072-#, python-format
1073-msgid "Reading filelist %s"
1074-msgstr ""
1075-
1076-#: ../duplicity/selection.py:322
1077-#, python-format
1078-msgid "Sorting filelist %s"
1079-msgstr ""
1080-
1081-#: ../duplicity/selection.py:350
1082-#, python-format
1083-msgid ""
1084-"Warning: file specification '%s' in filelist %s\n"
1085-"doesn't start with correct prefix %s. Ignoring."
1086-msgstr ""
1087-
1088-#: ../duplicity/selection.py:354
1089-msgid "Future prefix errors will not be logged."
1090-msgstr ""
1091-
1092-#: ../duplicity/selection.py:372
1093-#, python-format
1094-msgid "Error closing filelist %s"
1095-msgstr ""
1096-
1097-#: ../duplicity/selection.py:465
1098+#: ../duplicity/selection.py:353
1099 #, python-format
1100 msgid "Reading globbing filelist %s"
1101 msgstr ""
1102
1103-#: ../duplicity/selection.py:495
1104+#: ../duplicity/selection.py:385
1105 #, python-format
1106 msgid "Error compiling regular expression %s"
1107 msgstr ""
1108
1109-#: ../duplicity/selection.py:511
1110+#: ../duplicity/selection.py:402
1111 msgid ""
1112 "Warning: exclude-device-files is not the first selector.\n"
1113 "This may not be what you intended"
1114
1115=== modified file 'testing/functional/test_selection.py'
1116--- testing/functional/test_selection.py 2015-01-31 16:19:46 +0000
1117+++ testing/functional/test_selection.py 2015-03-12 21:50:57 +0000
1118@@ -24,7 +24,6 @@
1119
1120 from . import FunctionalTestCase
1121
1122-
1123 class IncludeExcludeFunctionalTest(FunctionalTestCase):
1124 """
1125 This contains methods used in the tests below for testing the include, exclude and various filelist features.
1126@@ -235,13 +234,13 @@
1127 self.assertEqual(restored, self.expected_restored_tree_with_trailing_space)
1128
1129
1130-class TestExcludeGlobbingFilelistTest(IncludeExcludeFunctionalTest):
1131+class TestExcludeFilelistTest(IncludeExcludeFunctionalTest):
1132 """
1133- Test --exclude-globbing-filelist using duplicity binary.
1134+ Test --exclude-filelist using duplicity binary.
1135 """
1136
1137- def test_exclude_globbing_filelist(self):
1138- """Test that exclude globbing filelist works in the basic case """
1139+ def test_exclude_filelist(self):
1140+ """Test that exclude filelist works in the basic case """
1141 # As this is an exclude filelist any lines with no +/- modifier should be treated as if they have a -.
1142 # Create a filelist
1143 with open('testfiles/exclude.txt', 'w') as f:
1144@@ -264,7 +263,50 @@
1145 '+ testfiles/select2/3\n'
1146 '+ testfiles/select2/1\n'
1147 'testfiles/select2/**')
1148- self.backup("full", "testfiles/select2", options=["--exclude-globbing-filelist=testfiles/exclude.txt"])
1149+ self.backup("full", "testfiles/select2", options=["--exclude-filelist=testfiles/exclude.txt"])
1150+ self.restore()
1151+ restore_dir = 'testfiles/restore_out'
1152+ restored = self.directory_tree_to_list_of_lists(restore_dir)
1153+ self.assertEqual(restored, self.expected_restored_tree)
1154+
1155+ def test_exclude_filelist_combined_imperfections(self):
1156+ """Test that exclude filelist works with imperfections in the input file"""
1157+ # This is a combined test for speed reasons. The individual imperfections are tested as unittests in
1158+ # unit/test_selection.
1159+ # Imperfections tested are;
1160+ # * Leading space/spaces before the modifier
1161+ # * Trailing space/spaces after the filename (but before the newline)
1162+ # * Blank lines (newline character only)
1163+ # * Line only containing spaces
1164+ # * Full-line comments with # as the first character and with leading/trailing spaces
1165+ # * Unnecessarily quoted filenames with/without modifier (both " and ')
1166+
1167+ # Create a filelist
1168+ with open('testfiles/exclude.txt', 'w') as f:
1169+ f.write('+ testfiles/select2/3/3sub3/3sub3sub2/3sub3sub2_file.txt\n'
1170+ 'testfiles/select2/3/3sub3/3sub3sub2\n'
1171+ '+ testfiles/select2/3/3sub2/3sub2sub2\n'
1172+ ' + testfiles/select2/3/3sub3\n' # Note leading space added here
1173+ '- testfiles/select2/3/3sub1\n'
1174+ ' testfiles/select2/2/2sub1/2sub1sub3\n' # Note leading spaces added here
1175+ '\n'
1176+ 'testfiles/select2/2/2sub1/2sub1sub2\n'
1177+ ' + testfiles/select2/2/2sub1 \n' # Note added trailing/leading space here
1178+ '- "testfiles/select2/1/1sub3/1sub3sub2"\n' # Unnecessary quotes
1179+ '# Testing a full-line comment\n'
1180+ "'testfiles/select2/1/1sub3/1sub3sub1' \n" # Note added spaces and quotes here
1181+ 'testfiles/select2/1/1sub2/1sub2sub3\n'
1182+ ' \n'
1183+ '+ testfiles/select2/1/1sub2/1sub2sub1\n'
1184+ '- testfiles/select2/1/1sub1/1sub1sub3/1sub1sub3_file.txt\n'
1185+ 'testfiles/select2/1/1sub1/1sub1sub2\n'
1186+ ' # Testing a full-line comment with leading and trailing spaces \n'
1187+ 'testfiles/select2/1/1sub2 \n' # Note added spaces here
1188+ '+ testfiles/select2/1.py\n'
1189+ '+ testfiles/select2/3 \n' # Note added space here
1190+ '+ testfiles/select2/1\n'
1191+ '- testfiles/select2/**')
1192+ self.backup("full", "testfiles/select2", options=["--exclude-filelist=testfiles/exclude.txt"])
1193 self.restore()
1194 restore_dir = 'testfiles/restore_out'
1195 restored = self.directory_tree_to_list_of_lists(restore_dir)
1196@@ -272,6 +314,8 @@
1197
1198 def test_exclude_globbing_filelist_combined_imperfections(self):
1199 """Test that exclude globbing filelist works with imperfections in the input file"""
1200+ # Identical to test_exclude_filelist_combined_imperfections and included to ensure that
1201+ # the deprecated --exclude-globbing-filelist function works as expected until it is deliberately removed.
1202 # This is a combined test for speed reasons. The individual imperfections are tested as unittests in
1203 # unit/test_selection.
1204 # Imperfections tested are;
1205@@ -313,7 +357,7 @@
1206 restored = self.directory_tree_to_list_of_lists(restore_dir)
1207 self.assertEqual(restored, self.expected_restored_tree)
1208
1209- def test_exclude_globbing_filelist_trailing_whitespace_folders_work_with_quotes(self):
1210+ def test_exclude_filelist_trailing_whitespace_folders_work_with_quotes(self):
1211 """Test that folders with trailing whitespace in the names work correctly if they are enclosed in quotes"""
1212 # Create a filelist
1213 with open('testfiles/exclude.txt', 'w') as f:
1214@@ -339,17 +383,17 @@
1215 '+ testfiles/select2/3\n'
1216 '+ testfiles/select2/1\n'
1217 'testfiles/select2/**')
1218- self.backup("full", "testfiles/select2", options=["--exclude-globbing-filelist=testfiles/exclude.txt"])
1219+ self.backup("full", "testfiles/select2", options=["--exclude-filelist=testfiles/exclude.txt"])
1220 self.restore()
1221 restore_dir = 'testfiles/restore_out'
1222 restored = self.directory_tree_to_list_of_lists(restore_dir)
1223 self.assertEqual(restored, self.expected_restored_tree_with_trailing_space)
1224
1225 @unittest.expectedFailure
1226- def test_exclude_globbing_filelist_progress_option(self):
1227- """Test that exclude globbing filelist is unaffected by the --progress option"""
1228+ def test_exclude_filelist_progress_option(self):
1229+ """Test that exclude filelist is unaffected by the --progress option"""
1230 # ToDo - currently fails. Bug #1264744 (https://bugs.launchpad.net/duplicity/+bug/1264744)
1231- # Create a filelist identical to that used in test_exclude_globbing_filelist
1232+ # Create a filelist identical to that used in test_exclude_filelist
1233 with open('testfiles/exclude.txt', 'w') as f:
1234 f.write('+ testfiles/select2/3/3sub3/3sub3sub2/3sub3sub2_file.txt\n'
1235 'testfiles/select2/3/3sub3/3sub3sub2\n'
1236@@ -371,170 +415,94 @@
1237 '+ testfiles/select2/1\n'
1238 'testfiles/select2/**')
1239
1240- # Backup the files exactly as in test_exclude_globbing_filelist, but with the --progress option
1241- self.backup("full", "testfiles/select2", options=["--exclude-globbing-filelist=testfiles/exclude.txt",
1242+ # Backup the files exactly as in test_exclude_filelist, but with the --progress option
1243+ self.backup("full", "testfiles/select2", options=["--exclude-filelist=testfiles/exclude.txt",
1244 "--progress"])
1245 self.restore()
1246 restore_dir = 'testfiles/restore_out'
1247 restored = self.directory_tree_to_list_of_lists(restore_dir)
1248- # The restored files should match those restored in test_exclude_globbing_filelist
1249- self.assertEqual(restored, self.expected_restored_tree)
1250-
1251-class TestIncludeGlobbingFilelistTest(IncludeExcludeFunctionalTest):
1252- """
1253- Test --include-globbing-filelist using duplicity binary.
1254- """
1255-
1256- def test_include_globbing_filelist(self):
1257- """Test that include globbing filelist works in the basic case"""
1258- # See test_exclude_globbing_filelist above for explanation of what is expected. As this is an include filelist
1259- # any lines with no +/- modifier should be treated as if they have a +.
1260- # Create a filelist
1261- with open('testfiles/include.txt', 'w') as f:
1262- f.write('testfiles/select2/3/3sub3/3sub3sub2/3sub3sub2_file.txt\n'
1263- '- testfiles/select2/3/3sub3/3sub3sub2\n'
1264- 'testfiles/select2/3/3sub2/3sub2sub2\n'
1265- '+ testfiles/select2/3/3sub3\n' # + added to ensure it makes no difference
1266- '- testfiles/select2/3/3sub1\n'
1267- '- testfiles/select2/2/2sub1/2sub1sub3\n'
1268- '- testfiles/select2/2/2sub1/2sub1sub2\n'
1269- 'testfiles/select2/2/2sub1\n'
1270- '- testfiles/select2/1/1sub3/1sub3sub2\n'
1271- '- testfiles/select2/1/1sub3/1sub3sub1\n'
1272- '- testfiles/select2/1/1sub2/1sub2sub3\n'
1273- '+ testfiles/select2/1/1sub2/1sub2sub1\n' # + added to ensure it makes no difference
1274- '- testfiles/select2/1/1sub1/1sub1sub3/1sub1sub3_file.txt\n'
1275- '- testfiles/select2/1/1sub1/1sub1sub2\n'
1276- '- testfiles/select2/1/1sub2\n'
1277- 'testfiles/select2/1.py\n'
1278- 'testfiles/select2/3\n'
1279- 'testfiles/select2/1\n'
1280- '- testfiles/select2/**')
1281- self.backup("full", "testfiles/select2", options=["--include-globbing-filelist=testfiles/include.txt"])
1282- self.restore()
1283- restore_dir = 'testfiles/restore_out'
1284- restored = self.directory_tree_to_list_of_lists(restore_dir)
1285- self.assertEqual(restored, self.expected_restored_tree)
1286-
1287- def test_include_globbing_filelist_combined_imperfections(self):
1288- """Test that include globbing filelist works with imperfections in the input file"""
1289- # This is a combined test for speed reasons. The individual imperfections are tested as unittests in
1290- # unit/test_selection.
1291- # Imperfections tested are;
1292- # * Leading space/spaces before the modifier
1293- # * Trailing space/spaces after the filename (but before the newline)
1294- # * Blank lines (newline character only)
1295- # * Line only containing spaces
1296- # * Full-line comments with # as the first character and with leading/trailing spaces
1297- # * Unnecessarily quoted filenames with/without modifier (both " and ')
1298- # Create a filelist
1299- with open('testfiles/include.txt', 'w') as f:
1300- f.write('testfiles/select2/3/3sub3/3sub3sub2/3sub3sub2_file.txt\n'
1301- '- testfiles/select2/3/3sub3/3sub3sub2\n'
1302- '"testfiles/select2/3/3sub2/3sub2sub2"\n'
1303- ' + testfiles/select2/3/3sub3\n' # + added to ensure it makes no difference
1304- '- testfiles/select2/3/3sub1\n'
1305- '- testfiles/select2/2/2sub1/2sub1sub3\n'
1306- ' - "testfiles/select2/2/2sub1/2sub1sub2"\n'
1307- 'testfiles/select2/2/2sub1 \n'
1308- '\n'
1309- '- testfiles/select2/1/1sub3/1sub3sub2\n'
1310- '- testfiles/select2/1/1sub3/1sub3sub1 \n'
1311- "- 'testfiles/select2/1/1sub2/1sub2sub3'\n"
1312- ' \n'
1313- ' + testfiles/select2/1/1sub2/1sub2sub1 \n' # + added to ensure it makes no difference
1314- '- testfiles/select2/1/1sub1/1sub1sub3/1sub1sub3_file.txt\n'
1315- ' - testfiles/select2/1/1sub1/1sub1sub2 \n'
1316- '# Testing full-line comment\n'
1317- '- testfiles/select2/1/1sub2\n'
1318- "'testfiles/select2/1.py'\n"
1319- 'testfiles/select2/3\n'
1320- ' # Testing another full-line comment \n'
1321- 'testfiles/select2/1\n'
1322- '- testfiles/select2/**')
1323- self.backup("full", "testfiles/select2", options=["--include-globbing-filelist=testfiles/include.txt"])
1324- self.restore()
1325- restore_dir = 'testfiles/restore_out'
1326- restored = self.directory_tree_to_list_of_lists(restore_dir)
1327- self.assertEqual(restored, self.expected_restored_tree)
1328-
1329+ # The restored files should match those restored in test_exclude_filelist
1330+ self.assertEqual(restored, self.expected_restored_tree)
1331
1332 class TestIncludeFilelistTest(IncludeExcludeFunctionalTest):
1333 """
1334 Test --include-filelist using duplicity binary.
1335 """
1336- @unittest.expectedFailure
1337+
1338 def test_include_filelist(self):
1339 """Test that include filelist works in the basic case"""
1340- # See test_exclude_globbing_filelist above for explanation of what is expected. As this is an include filelist
1341+ # See test_exclude_filelist above for explanation of what is expected. As this is an include filelist
1342 # any lines with no +/- modifier should be treated as if they have a +.
1343- # ToDo Currently fails - Bug #1408411 (https://bugs.launchpad.net/duplicity/+bug/1408411)
1344- # Create a filelist
1345- with open('testfiles/include.txt', 'w') as f:
1346- f.write('testfiles/select2/3/3sub3/3sub3sub2/3sub3sub2_file.txt\n'
1347- '- testfiles/select2/3/3sub3/3sub3sub2\n'
1348- 'testfiles/select2/3/3sub2/3sub2sub2\n'
1349- '+ testfiles/select2/3/3sub3\n' # + added to ensure it makes no difference
1350- '- testfiles/select2/3/3sub1\n'
1351- '- testfiles/select2/2/2sub1/2sub1sub3\n'
1352- '- testfiles/select2/2/2sub1/2sub1sub2\n'
1353- 'testfiles/select2/2/2sub1\n'
1354- '- testfiles/select2/1/1sub3/1sub3sub2\n'
1355- '- testfiles/select2/1/1sub3/1sub3sub1\n'
1356- '- testfiles/select2/1/1sub2/1sub2sub3\n'
1357- '+ testfiles/select2/1/1sub2/1sub2sub1\n' # + added to ensure it makes no difference
1358- '- testfiles/select2/1/1sub1/1sub1sub3/1sub1sub3_file.txt\n'
1359- '- testfiles/select2/1/1sub1/1sub1sub2\n'
1360- '- testfiles/select2/1/1sub2\n'
1361- 'testfiles/select2/1.py\n'
1362- 'testfiles/select2/3\n'
1363- '- testfiles/select2/2\n' # es instead of ea as no globbing - **
1364- 'testfiles/select2/1\n'
1365- '- "testfiles/select2/trailing_space "\n' # es instead of ea as no globbing - **
1366- '- testfiles/select2/1.doc') # es instead of ea as no globbing - **
1367- self.backup("full", "testfiles/select2", options=["--include-filelist=testfiles/include.txt"])
1368- self.restore()
1369- restore_dir = 'testfiles/restore_out'
1370- restored = self.directory_tree_to_list_of_lists(restore_dir)
1371- self.assertEqual(restored, self.expected_restored_tree)
1372-
1373- def test_include_filelist_workaround(self):
1374- """Test that include filelist works in the basic case"""
1375- # This is a modified version of test_include_filelist that passes, despite Bug #1408411
1376- # It is still a valid test, it just does not test as many selection features as the above.
1377- # Create a filelist
1378- with open('testfiles/include.txt', 'w') as f:
1379- f.write('testfiles/select2/3/3sub3/3sub3sub2/3sub3sub2_file.txt\n'
1380- # '- testfiles/select2/3/3sub3/3sub3sub2\n' # Commented out because of Bug #1408411
1381- 'testfiles/select2/3/3sub2/3sub2sub2\n'
1382- '+ testfiles/select2/3/3sub3\n' # + added to ensure it makes no difference
1383- '- testfiles/select2/3/3sub1\n'
1384- '- testfiles/select2/2/2sub1/2sub1sub3\n'
1385- '- testfiles/select2/2/2sub1/2sub1sub2\n'
1386- 'testfiles/select2/2/2sub1\n'
1387- '- testfiles/select2/2/2sub3\n' # Added because of Bug #1408411
1388- '- testfiles/select2/2/2sub2\n' # Added because of Bug #1408411
1389- '- testfiles/select2/1/1sub3/1sub3sub2\n'
1390- '- testfiles/select2/1/1sub3/1sub3sub1\n'
1391- '- testfiles/select2/1/1sub2/1sub2sub3\n'
1392- '- testfiles/select2/1/1sub2/1sub2sub2\n' # Added because of Bug #1408411
1393- '+ testfiles/select2/1/1sub2/1sub2sub1\n' # + added to ensure it makes no difference
1394- '- testfiles/select2/1/1sub1/1sub1sub3/1sub1sub3_file.txt\n'
1395- '- testfiles/select2/1/1sub1/1sub1sub2\n'
1396- # '- testfiles/select2/1/1sub2\n' # Commented out because of Bug #1408411
1397- 'testfiles/select2/1.py\n'
1398- 'testfiles/select2/3\n'
1399- # '- testfiles/select2/2\n' # Commented out because of Bug #1408411
1400- 'testfiles/select2/1\n'
1401- '- "testfiles/select2/trailing_space "\n' # es instead of ea as no globbing - **
1402- '- testfiles/select2/1.doc') # es instead of ea as no globbing - **
1403- self.backup("full", "testfiles/select2", options=["--include-filelist=testfiles/include.txt"])
1404- self.restore()
1405- restore_dir = 'testfiles/restore_out'
1406- restored = self.directory_tree_to_list_of_lists(restore_dir)
1407- self.assertEqual(restored, self.expected_restored_tree)
1408-
1409- def test_include_filelist_workaround_combined_imperfections(self):
1410+ # Create a filelist
1411+ with open('testfiles/include.txt', 'w') as f:
1412+ f.write('testfiles/select2/3/3sub3/3sub3sub2/3sub3sub2_file.txt\n'
1413+ '- testfiles/select2/3/3sub3/3sub3sub2\n'
1414+ 'testfiles/select2/3/3sub2/3sub2sub2\n'
1415+ '+ testfiles/select2/3/3sub3\n' # + added to ensure it makes no difference
1416+ '- testfiles/select2/3/3sub1\n'
1417+ '- testfiles/select2/2/2sub1/2sub1sub3\n'
1418+ '- testfiles/select2/2/2sub1/2sub1sub2\n'
1419+ 'testfiles/select2/2/2sub1\n'
1420+ '- testfiles/select2/1/1sub3/1sub3sub2\n'
1421+ '- testfiles/select2/1/1sub3/1sub3sub1\n'
1422+ '- testfiles/select2/1/1sub2/1sub2sub3\n'
1423+ '+ testfiles/select2/1/1sub2/1sub2sub1\n' # + added to ensure it makes no difference
1424+ '- testfiles/select2/1/1sub1/1sub1sub3/1sub1sub3_file.txt\n'
1425+ '- testfiles/select2/1/1sub1/1sub1sub2\n'
1426+ '- testfiles/select2/1/1sub2\n'
1427+ 'testfiles/select2/1.py\n'
1428+ 'testfiles/select2/3\n'
1429+ 'testfiles/select2/1\n'
1430+ '- testfiles/select2/**')
1431+ self.backup("full", "testfiles/select2", options=["--include-filelist=testfiles/include.txt"])
1432+ self.restore()
1433+ restore_dir = 'testfiles/restore_out'
1434+ restored = self.directory_tree_to_list_of_lists(restore_dir)
1435+ self.assertEqual(restored, self.expected_restored_tree)
1436+
1437+ def test_include_filelist_combined_imperfections(self):
1438+ """Test that include filelist works with imperfections in the input file"""
1439+ # This is a combined test for speed reasons. The individual imperfections are tested as unittests in
1440+ # unit/test_selection.
1441+ # Imperfections tested are;
1442+ # * Leading space/spaces before the modifier
1443+ # * Trailing space/spaces after the filename (but before the newline)
1444+ # * Blank lines (newline character only)
1445+ # * Line only containing spaces
1446+ # * Full-line comments with # as the first character and with leading/trailing spaces
1447+ # * Unnecessarily quoted filenames with/without modifier (both " and ')
1448+ # Create a filelist
1449+ with open('testfiles/include.txt', 'w') as f:
1450+ f.write('testfiles/select2/3/3sub3/3sub3sub2/3sub3sub2_file.txt\n'
1451+ '- testfiles/select2/3/3sub3/3sub3sub2\n'
1452+ '"testfiles/select2/3/3sub2/3sub2sub2"\n'
1453+ ' + testfiles/select2/3/3sub3\n' # + added to ensure it makes no difference
1454+ '- testfiles/select2/3/3sub1\n'
1455+ '- testfiles/select2/2/2sub1/2sub1sub3\n'
1456+ ' - "testfiles/select2/2/2sub1/2sub1sub2"\n'
1457+ 'testfiles/select2/2/2sub1 \n'
1458+ '\n'
1459+ '- testfiles/select2/1/1sub3/1sub3sub2\n'
1460+ '- testfiles/select2/1/1sub3/1sub3sub1 \n'
1461+ "- 'testfiles/select2/1/1sub2/1sub2sub3'\n"
1462+ ' \n'
1463+ ' + testfiles/select2/1/1sub2/1sub2sub1 \n' # + added to ensure it makes no difference
1464+ '- testfiles/select2/1/1sub1/1sub1sub3/1sub1sub3_file.txt\n'
1465+ ' - testfiles/select2/1/1sub1/1sub1sub2 \n'
1466+ '# Testing full-line comment\n'
1467+ '- testfiles/select2/1/1sub2\n'
1468+ "'testfiles/select2/1.py'\n"
1469+ 'testfiles/select2/3\n'
1470+ ' # Testing another full-line comment \n'
1471+ 'testfiles/select2/1\n'
1472+ '- testfiles/select2/**')
1473+ self.backup("full", "testfiles/select2", options=["--include-filelist=testfiles/include.txt"])
1474+ self.restore()
1475+ restore_dir = 'testfiles/restore_out'
1476+ restored = self.directory_tree_to_list_of_lists(restore_dir)
1477+ self.assertEqual(restored, self.expected_restored_tree)
1478+
1479+ def test_include_filelist_workaround_combined_imperfections_no_wildcards(self):
1480 """Test that include filelist works with imperfections in the input file"""
1481 # This is a modified version of test_include_filelist that passes, despite Bug #1408411
1482 # It is still a valid test, it just does not test as many selection features as the above.
1483@@ -574,14 +542,58 @@
1484 'testfiles/select2/3\n'
1485 # '- testfiles/select2/2\n' # Commented out because of Bug #1408411
1486 'testfiles/select2/1\n'
1487- '- "testfiles/select2/trailing_space "\n' # es instead of ea as no globbing - **
1488- '- testfiles/select2/1.doc') # es instead of ea as no globbing - **
1489+ '- "testfiles/select2/trailing_space "\n' # es instead of ea as no wildcard - **
1490+ '- testfiles/select2/1.doc') # es instead of ea as no wildcard - **
1491 self.backup("full", "testfiles/select2", options=["--include-filelist=testfiles/include.txt"])
1492 self.restore()
1493 restore_dir = 'testfiles/restore_out'
1494 restored = self.directory_tree_to_list_of_lists(restore_dir)
1495 self.assertEqual(restored, self.expected_restored_tree)
1496
1497+ def test_include_globbing_filelist_combined_imperfections(self):
1498+ """Test that include globbing filelist works with imperfections in the input file"""
1499+ # Identical to test_include_filelist_combined_imperfections and included to ensure that
1500+ # the deprecated --include-globbing-filelist function works as expected until it is deliberately removed.
1501+ # This is a combined test for speed reasons. The individual imperfections are tested as unittests in
1502+ # unit/test_selection.
1503+ # Imperfections tested are;
1504+ # * Leading space/spaces before the modifier
1505+ # * Trailing space/spaces after the filename (but before the newline)
1506+ # * Blank lines (newline character only)
1507+ # * Line only containing spaces
1508+ # * Full-line comments with # as the first character and with leading/trailing spaces
1509+ # * Unnecessarily quoted filenames with/without modifier (both " and ')
1510+ # Create a filelist
1511+ with open('testfiles/include.txt', 'w') as f:
1512+ f.write('testfiles/select2/3/3sub3/3sub3sub2/3sub3sub2_file.txt\n'
1513+ '- testfiles/select2/3/3sub3/3sub3sub2\n'
1514+ '"testfiles/select2/3/3sub2/3sub2sub2"\n'
1515+ ' + testfiles/select2/3/3sub3\n' # + added to ensure it makes no difference
1516+ '- testfiles/select2/3/3sub1\n'
1517+ '- testfiles/select2/2/2sub1/2sub1sub3\n'
1518+ ' - "testfiles/select2/2/2sub1/2sub1sub2"\n'
1519+ 'testfiles/select2/2/2sub1 \n'
1520+ '\n'
1521+ '- testfiles/select2/1/1sub3/1sub3sub2\n'
1522+ '- testfiles/select2/1/1sub3/1sub3sub1 \n'
1523+ "- 'testfiles/select2/1/1sub2/1sub2sub3'\n"
1524+ ' \n'
1525+ ' + testfiles/select2/1/1sub2/1sub2sub1 \n' # + added to ensure it makes no difference
1526+ '- testfiles/select2/1/1sub1/1sub1sub3/1sub1sub3_file.txt\n'
1527+ ' - testfiles/select2/1/1sub1/1sub1sub2 \n'
1528+ '# Testing full-line comment\n'
1529+ '- testfiles/select2/1/1sub2\n'
1530+ "'testfiles/select2/1.py'\n"
1531+ 'testfiles/select2/3\n'
1532+ ' # Testing another full-line comment \n'
1533+ 'testfiles/select2/1\n'
1534+ '- testfiles/select2/**')
1535+ self.backup("full", "testfiles/select2", options=["--include-globbing-filelist=testfiles/include.txt"])
1536+ self.restore()
1537+ restore_dir = 'testfiles/restore_out'
1538+ restored = self.directory_tree_to_list_of_lists(restore_dir)
1539+ self.assertEqual(restored, self.expected_restored_tree)
1540+
1541
1542 class TestIncludeExcludedForContents(IncludeExcludeFunctionalTest):
1543 """ Test to check that folders that are excluded are included if they contain includes of higher priority.
1544@@ -614,28 +626,28 @@
1545
1546 def test_include_globbing_filelist(self):
1547 """test an excluded folder is included for included contents with an include-globbing-filelist """
1548+ # Deprecated, but include for now to ensure it keeps working until it is deliberately removed.
1549 self.write_filelist("testfiles/include.txt")
1550 self.backup("full", "testfiles/select/1", options=["--include-globbing-filelist=testfiles/include.txt"])
1551 self.restore_and_check()
1552
1553 def test_exclude_globbing_filelist(self):
1554 """test an excluded folder is included for included contents with an exclude-globbing-filelist """
1555+ # Deprecated, but include for now to ensure it keeps working until it is deliberately removed.
1556 self.write_filelist("testfiles/exclude.txt")
1557 self.backup("full", "testfiles/select/1", options=["--exclude-globbing-filelist=testfiles/exclude.txt"])
1558 self.restore_and_check()
1559
1560- @unittest.expectedFailure
1561 def test_include_filelist(self):
1562 """test an excluded folder is included for included contents with an include-filelist (non-globbing) """
1563- # ToDo - currently fails - Bug #1408411 (https://bugs.launchpad.net/duplicity/+bug/1408411)
1564+ # Regression test for Bug #1408411 (https://bugs.launchpad.net/duplicity/+bug/1408411)
1565 self.write_filelist("testfiles/include.txt")
1566 self.backup("full", "testfiles/select/1", options=["--include-filelist=testfiles/include.txt"])
1567 self.restore_and_check()
1568
1569- @unittest.expectedFailure
1570 def test_exclude_filelist(self):
1571 """test an excluded folder is included for included contents with an exclude-filelist (non-globbing) """
1572- # ToDo - currently fails - Bug #1408411 (https://bugs.launchpad.net/duplicity/+bug/1408411)
1573+ # Regression test for Bug #1408411 (https://bugs.launchpad.net/duplicity/+bug/1408411)
1574 self.write_filelist("testfiles/exclude.txt")
1575 self.backup("full", "testfiles/select/1", options=["--exclude-filelist=testfiles/exclude.txt"])
1576 self.restore_and_check()
1577@@ -653,38 +665,38 @@
1578 restored = self.directory_tree_to_list_of_lists(restore_dir)
1579 self.assertEqual(restored, [['2'], ['1']])
1580
1581- def test_exclude_globbing_filelist_asterisks_none(self):
1582- """Basic exclude globbing filelist."""
1583+ def test_exclude_filelist_asterisks_none(self):
1584+ """Basic exclude filelist."""
1585 with open("testfiles/filelist.txt", 'w') as f:
1586 f.write("+ testfiles/select/1/2/1\n"
1587 "- testfiles/select/1/2\n"
1588 "- testfiles/select/1/1\n"
1589 "- testfiles/select/1/3")
1590- self.backup("full", "testfiles/select/1", options=["--exclude-globbing-filelist=testfiles/filelist.txt"])
1591+ self.backup("full", "testfiles/select/1", options=["--exclude-filelist=testfiles/filelist.txt"])
1592 self.restore_and_check()
1593
1594 @unittest.expectedFailure
1595- def test_exclude_globbing_filelist_asterisks_single(self):
1596- """Exclude globbing filelist with asterisks replacing folders."""
1597+ def test_exclude_filelist_asterisks_single(self):
1598+ """Exclude filelist with asterisks replacing folders."""
1599 # Todo: Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371)
1600 with open("testfiles/filelist.txt", 'w') as f:
1601 f.write("+ */select/1/2/1\n"
1602 "- */select/1/2\n"
1603 "- testfiles/*/1/1\n"
1604 "- */*/1/3")
1605- self.backup("full", "testfiles/select/1", options=["--exclude-globbing-filelist=testfiles/filelist.txt"])
1606+ self.backup("full", "testfiles/select/1", options=["--exclude-filelist=testfiles/filelist.txt"])
1607 self.restore_and_check()
1608
1609 @unittest.expectedFailure
1610- def test_exclude_globbing_filelist_asterisks_double_asterisks(self):
1611- """Exclude globbing filelist with double asterisks replacing folders."""
1612+ def test_exclude_filelist_asterisks_double_asterisks(self):
1613+ """Exclude filelist with double asterisks replacing folders."""
1614 # Todo: Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371)
1615 with open("testfiles/filelist.txt", 'w') as f:
1616 f.write("+ **/1/2/1\n"
1617 "- **/1/2\n"
1618 "- **/select/1/1\n"
1619 "- testfiles/select/1/3")
1620- self.backup("full", "testfiles/select/1", options=["--exclude-globbing-filelist=testfiles/filelist.txt"])
1621+ self.backup("full", "testfiles/select/1", options=["--exclude-filelist=testfiles/filelist.txt"])
1622 self.restore_and_check()
1623
1624 def test_commandline_asterisks_single_excludes_only(self):
1625@@ -738,43 +750,43 @@
1626 restored = self.directory_tree_to_list_of_lists(restore_dir)
1627 self.assertEqual(restored, [['2'], ['1']])
1628
1629- def test_exclude_globbing_filelist_trailing_slashes(self):
1630- """test_exclude_globbing_filelist_asterisks_none with trailing slashes."""
1631+ def test_exclude_filelist_trailing_slashes(self):
1632+ """test_exclude_filelist_asterisks_none with trailing slashes."""
1633 with open("testfiles/filelist.txt", 'w') as f:
1634 f.write("+ testfiles/select/1/2/1/\n"
1635 "- testfiles/select/1/2/\n"
1636 "- testfiles/select/1/1/\n"
1637 "- testfiles/select/1/3/")
1638- self.backup("full", "testfiles/select/1", options=["--exclude-globbing-filelist=testfiles/filelist.txt"])
1639+ self.backup("full", "testfiles/select/1", options=["--exclude-filelist=testfiles/filelist.txt"])
1640 self.restore_and_check()
1641
1642 @unittest.expectedFailure
1643- def test_exclude_globbing_filelist_trailing_slashes_single_wildcards_excludes(self):
1644- """test_exclude_globbing_filelist_trailing_slashes with single wildcards in excludes."""
1645+ def test_exclude_filelist_trailing_slashes_single_wildcards_excludes(self):
1646+ """test_exclude_filelist_trailing_slashes with single wildcards in excludes."""
1647 # Todo: Bug #932482 (https://bugs.launchpad.net/duplicity/+bug/932482)
1648 with open("testfiles/filelist.txt", 'w') as f:
1649 f.write("+ testfiles/select/1/2/1/\n"
1650 "- */select/1/2/\n"
1651 "- testfiles/*/1/1/\n"
1652 "- */*/1/3/")
1653- self.backup("full", "testfiles/select/1", options=["--exclude-globbing-filelist=testfiles/filelist.txt"])
1654+ self.backup("full", "testfiles/select/1", options=["--exclude-filelist=testfiles/filelist.txt"])
1655 self.restore_and_check()
1656
1657 @unittest.expectedFailure
1658- def test_exclude_globbing_filelist_trailing_slashes_double_wildcards_excludes(self):
1659- """test_exclude_globbing_filelist_trailing_slashes with double wildcards in excludes."""
1660+ def test_exclude_filelist_trailing_slashes_double_wildcards_excludes(self):
1661+ """test_exclude_filelist_trailing_slashes with double wildcards in excludes."""
1662 # Todo: Bug #932482 (https://bugs.launchpad.net/duplicity/+bug/932482)
1663 with open("testfiles/filelist.txt", 'w') as f:
1664 f.write("+ testfiles/select/1/2/1/\n"
1665 "- **/1/2/\n"
1666 "- **/1/1/\n"
1667 "- **/1/3/")
1668- self.backup("full", "testfiles/select/1", options=["--exclude-globbing-filelist=testfiles/filelist.txt"])
1669+ self.backup("full", "testfiles/select/1", options=["--exclude-filelist=testfiles/filelist.txt"])
1670 self.restore_and_check()
1671
1672 @unittest.expectedFailure
1673- def test_exclude_globbing_filelist_trailing_slashes_double_wildcards_excludes(self):
1674- """test_exclude_globbing_filelist_trailing_slashes with double wildcards in excludes."""
1675+ def test_exclude_filelist_trailing_slashes_double_wildcards_excludes(self):
1676+ """test_exclude_filelist_trailing_slashes with double wildcards in excludes."""
1677 # Todo: Bug #932482 (https://bugs.launchpad.net/duplicity/+bug/932482) and likely
1678 # Todo: Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371)
1679 with open("testfiles/filelist.txt", 'w') as f:
1680@@ -782,11 +794,11 @@
1681 "- **/1/2/\n"
1682 "- **/1/1/\n"
1683 "- **/1/3/")
1684- self.backup("full", "testfiles/select/1", options=["--exclude-globbing-filelist=testfiles/filelist.txt"])
1685+ self.backup("full", "testfiles/select/1", options=["--exclude-filelist=testfiles/filelist.txt"])
1686 self.restore_and_check()
1687
1688 @unittest.expectedFailure
1689- def test_exclude_globbing_filelist_trailing_slashes_wildcards(self):
1690+ def test_exclude_filelist_trailing_slashes_wildcards(self):
1691 """test_commandline_asterisks_single_excludes_only with trailing slashes."""
1692 # Todo: Bug #932482 (https://bugs.launchpad.net/duplicity/+bug/932482)
1693 self.backup("full", "testfiles/select/1",
1694@@ -796,7 +808,5 @@
1695 "--exclude", "*/select/1/3/"])
1696 self.restore_and_check()
1697
1698-
1699-
1700 if __name__ == "__main__":
1701 unittest.main()
1702
1703=== added file 'testing/stdin_test.sh'
1704--- testing/stdin_test.sh 1970-01-01 00:00:00 +0000
1705+++ testing/stdin_test.sh 2015-03-12 21:50:57 +0000
1706@@ -0,0 +1,203 @@
1707+#!/bin/sh
1708+# Script to show the current behaviour of duplicity's --include/exclude-filelist-stdin
1709+# function. This is currently hard to show in functional tests because the stdin-processing
1710+# logic is in the commandline parser.
1711+# (c) 2015 Aaron Whitehouse <aaron@whitehouse.kiwi.nz>
1712+# GPLv2 or any later version
1713+export PASSPHRASE=test
1714+
1715+TESTDIR=/tmp/duplicity_test
1716+mkdir $TESTDIR
1717+SOURCEDIR=$TESTDIR/dup_source
1718+mkdir $SOURCEDIR
1719+TARGETDIR=$TESTDIR/dup_target
1720+mkdir $TARGETDIR
1721+RESTOREDIR=$TESTDIR/dup_restore
1722+mkdir $RESTOREDIR
1723+
1724+tar -C $SOURCEDIR -xvf testfiles.tar.gz testfiles/select
1725+
1726+DUPLICITY_CMD="../bin/duplicity"
1727+export PYTHONPATH=../
1728+
1729+$DUPLICITY_CMD -V
1730+
1731+echo "==========="
1732+echo "FIRST TEST."
1733+echo "==========="
1734+TEST1="Test with exclude-globbing"
1735+echo "${TEST1}"
1736+echo "+ $SOURCEDIR/testfiles/select/1/1" > $TESTDIR/exclude.txt
1737+echo "- $SOURCEDIR/testfiles/select/1/2" >> $TESTDIR/exclude.txt
1738+echo "+ $SOURCEDIR/testfiles/select/1/3" >> $TESTDIR/exclude.txt
1739+echo "- $SOURCEDIR/testfiles/select/3" >> $TESTDIR/exclude.txt
1740+echo "- $SOURCEDIR/**" >> $TESTDIR/exclude.txt
1741+
1742+$DUPLICITY_CMD --exclude-globbing-filelist $TESTDIR/exclude.txt $SOURCEDIR file://$TARGETDIR
1743+$DUPLICITY_CMD file://$TARGETDIR $RESTOREDIR
1744+echo "Number of files/folders:"
1745+OUTPUT_TEST1="$(find $RESTOREDIR | wc -l)"
1746+echo "${OUTPUT_TEST1}"
1747+
1748+rm -r $TESTDIR
1749+
1750+echo "==========="
1751+echo "SECOND TEST."
1752+echo "==========="
1753+TEST2="Test with exclude"
1754+echo "${TEST2}"
1755+
1756+mkdir $TESTDIR
1757+mkdir $SOURCEDIR
1758+mkdir $TARGETDIR
1759+mkdir $RESTOREDIR
1760+tar -C $SOURCEDIR -xvf testfiles.tar.gz testfiles/select
1761+
1762+echo "+ $SOURCEDIR/testfiles/select/1/1" > $TESTDIR/exclude.txt
1763+echo "- $SOURCEDIR/testfiles/select/1/2" >> $TESTDIR/exclude.txt
1764+echo "+ $SOURCEDIR/testfiles/select/1/3" >> $TESTDIR/exclude.txt
1765+echo "- $SOURCEDIR/testfiles/select/3" >> $TESTDIR/exclude.txt
1766+echo "- $SOURCEDIR/**" >> $TESTDIR/exclude.txt
1767+
1768+$DUPLICITY_CMD --exclude-filelist $TESTDIR/exclude.txt $SOURCEDIR file://$TARGETDIR
1769+$DUPLICITY_CMD file://$TARGETDIR $RESTOREDIR
1770+echo "Number of files/folders:"
1771+find $RESTOREDIR | wc -l
1772+OUTPUT_TEST2="$(find $RESTOREDIR | wc -l)"
1773+echo "${OUTPUT_TEST2}"
1774+
1775+rm -r $TESTDIR
1776+
1777+echo "==========="
1778+echo "THIRD TEST."
1779+echo "==========="
1780+TEST3="Test with stdin with exclude"
1781+echo "${TEST3}"
1782+mkdir $TESTDIR
1783+mkdir $SOURCEDIR
1784+mkdir $TARGETDIR
1785+mkdir $RESTOREDIR
1786+tar -C $SOURCEDIR -xvf testfiles.tar.gz testfiles/select
1787+
1788+echo "+ $SOURCEDIR/testfiles/select/1/1" > $TESTDIR/exclude.txt
1789+echo "- $SOURCEDIR/testfiles/select/1/2" >> $TESTDIR/exclude.txt
1790+echo "+ $SOURCEDIR/testfiles/select/1/3" >> $TESTDIR/exclude.txt
1791+echo "- $SOURCEDIR/testfiles/select/3" >> $TESTDIR/exclude.txt
1792+echo "- $SOURCEDIR/**" >> $TESTDIR/exclude.txt
1793+
1794+cat $TESTDIR/exclude.txt | $DUPLICITY_CMD --exclude-filelist-stdin $SOURCEDIR file://$TARGETDIR
1795+$DUPLICITY_CMD file://$TARGETDIR $RESTOREDIR
1796+echo "Number of files/folders:"
1797+OUTPUT_TEST3="$(find $RESTOREDIR | wc -l)"
1798+echo "${OUTPUT_TEST3}"
1799+
1800+rm -r $TESTDIR
1801+
1802+echo "==========="
1803+echo "FOURTH TEST."
1804+echo "==========="
1805+TEST4="Test with nothing"
1806+echo "${TEST4}"
1807+mkdir $TESTDIR
1808+mkdir $SOURCEDIR
1809+mkdir $TARGETDIR
1810+mkdir $RESTOREDIR
1811+tar -C $SOURCEDIR -xvf testfiles.tar.gz testfiles/select
1812+
1813+echo "+ $SOURCEDIR/testfiles/select/1/1" > $TESTDIR/exclude.txt
1814+echo "- $SOURCEDIR/testfiles/select/1/2" >> $TESTDIR/exclude.txt
1815+echo "+ $SOURCEDIR/testfiles/select/1/3" >> $TESTDIR/exclude.txt
1816+echo "- $SOURCEDIR/testfiles/select/3" >> $TESTDIR/exclude.txt
1817+echo "- $SOURCEDIR/**" >> $TESTDIR/exclude.txt
1818+
1819+$DUPLICITY_CMD $SOURCEDIR file://$TARGETDIR
1820+$DUPLICITY_CMD file://$TARGETDIR $RESTOREDIR
1821+echo "Number of files/folders:"
1822+OUTPUT_TEST4="$(find $RESTOREDIR | wc -l)"
1823+echo "${OUTPUT_TEST4}"
1824+
1825+rm -r $TESTDIR
1826+
1827+echo "==========="
1828+echo "FIFTH TEST."
1829+echo "==========="
1830+TEST5="Test using /dev/stdin as a substitute for --exclude-filelist-stdin"
1831+echo "${TEST5}"
1832+mkdir $TESTDIR
1833+mkdir $SOURCEDIR
1834+mkdir $TARGETDIR
1835+mkdir $RESTOREDIR
1836+tar -C $SOURCEDIR -xvf testfiles.tar.gz testfiles/select
1837+
1838+echo "+ $SOURCEDIR/testfiles/select/1/1" > $TESTDIR/exclude.txt
1839+echo "- $SOURCEDIR/testfiles/select/1/2" >> $TESTDIR/exclude.txt
1840+echo "+ $SOURCEDIR/testfiles/select/1/3" >> $TESTDIR/exclude.txt
1841+echo "- $SOURCEDIR/testfiles/select/3" >> $TESTDIR/exclude.txt
1842+echo "- $SOURCEDIR/**" >> $TESTDIR/exclude.txt
1843+
1844+cat $TESTDIR/exclude.txt | $DUPLICITY_CMD --exclude-filelist /dev/stdin $SOURCEDIR file://$TARGETDIR
1845+$DUPLICITY_CMD file://$TARGETDIR $RESTOREDIR
1846+echo "Number of files/folders:"
1847+OUTPUT_TEST5="$(find $RESTOREDIR | wc -l)"
1848+echo "${OUTPUT_TEST5}"
1849+
1850+rm -r $TESTDIR
1851+
1852+echo "==========="
1853+echo "SIXTH TEST."
1854+echo "==========="
1855+TEST6="Test with stdin with include"
1856+echo "${TEST6}"
1857+mkdir $TESTDIR
1858+mkdir $SOURCEDIR
1859+mkdir $TARGETDIR
1860+mkdir $RESTOREDIR
1861+tar -C $SOURCEDIR -xvf testfiles.tar.gz testfiles/select
1862+
1863+echo "+ $SOURCEDIR/testfiles/select/1/1" > $TESTDIR/include.txt
1864+echo "- $SOURCEDIR/testfiles/select/1/2" >> $TESTDIR/include.txt
1865+echo "+ $SOURCEDIR/testfiles/select/1/3" >> $TESTDIR/include.txt
1866+echo "- $SOURCEDIR/testfiles/select/3" >> $TESTDIR/include.txt
1867+echo "- $SOURCEDIR/**" >> $TESTDIR/include.txt
1868+
1869+cat $TESTDIR/include.txt | $DUPLICITY_CMD --include-filelist-stdin $SOURCEDIR file://$TARGETDIR
1870+$DUPLICITY_CMD file://$TARGETDIR $RESTOREDIR
1871+echo "Number of files/folders:"
1872+OUTPUT_TEST6="$(find $RESTOREDIR | wc -l)"
1873+echo "${OUTPUT_TEST6}"
1874+
1875+rm -r $TESTDIR
1876+
1877+echo "============"
1878+echo "SEVENTH TEST."
1879+echo "============"
1880+TEST7="Test using /dev/stdin as a substitute for --include-filelist-stdin"
1881+echo "${TEST7}"
1882+mkdir $TESTDIR
1883+mkdir $SOURCEDIR
1884+mkdir $TARGETDIR
1885+mkdir $RESTOREDIR
1886+tar -C $SOURCEDIR -xvf testfiles.tar.gz testfiles/select
1887+
1888+echo "+ $SOURCEDIR/testfiles/select/1/1" > $TESTDIR/include.txt
1889+echo "- $SOURCEDIR/testfiles/select/1/2" >> $TESTDIR/include.txt
1890+echo "+ $SOURCEDIR/testfiles/select/1/3" >> $TESTDIR/include.txt
1891+echo "- $SOURCEDIR/testfiles/select/3" >> $TESTDIR/include.txt
1892+echo "- $SOURCEDIR/**" >> $TESTDIR/include.txt
1893+
1894+cat $TESTDIR/include.txt | $DUPLICITY_CMD --include-filelist /dev/stdin $SOURCEDIR file://$TARGETDIR
1895+$DUPLICITY_CMD file://$TARGETDIR $RESTOREDIR
1896+echo "Number of files/folders:"
1897+OUTPUT_TEST7="$(find $RESTOREDIR | wc -l)"
1898+echo "${OUTPUT_TEST7}"
1899+
1900+rm -r $TESTDIR
1901+
1902+unset PASSPHRASE
1903+echo "1.""${TEST1}" "${OUTPUT_TEST1}"
1904+echo "2.""${TEST2}" "${OUTPUT_TEST2}"
1905+echo "3.""${TEST3}" "${OUTPUT_TEST3}"
1906+echo "4.""${TEST4}" "${OUTPUT_TEST4}"
1907+echo "5.""${TEST5}" "${OUTPUT_TEST5}"
1908+echo "6.""${TEST6}" "${OUTPUT_TEST6}"
1909+echo "7.""${TEST7}" "${OUTPUT_TEST7}"
1910
1911=== modified file 'testing/unit/test_selection.py'
1912--- testing/unit/test_selection.py 2015-02-01 17:37:37 +0000
1913+++ testing/unit/test_selection.py 2015-03-12 21:50:57 +0000
1914@@ -102,311 +102,6 @@
1915 assert sf2(self.makeext("what/ever.py")) == 0
1916 assert sf2(self.makeext("what/ever.py/foo")) == 0
1917
1918- def testFilelistInclude(self):
1919- """Test included filelist"""
1920- fp = StringIO.StringIO("""
1921-testfiles/select/1/2
1922-testfiles/select/1
1923-testfiles/select/1/2/3
1924-testfiles/select/3/3/2""")
1925- sf = self.Select.filelist_get_sf(fp, 1, "test")
1926- assert sf(self.root) == 1
1927- assert sf(self.makeext("1")) == 1
1928- assert sf(self.makeext("1/1")) is None
1929- assert sf(self.makeext("1/2/3")) == 1
1930- assert sf(self.makeext("2/2")) is None
1931- assert sf(self.makeext("3")) == 1
1932- assert sf(self.makeext("3/3")) == 1
1933- assert sf(self.makeext("3/3/3")) is None
1934-
1935- def test_filelist_include_1_trailing_white_space(self):
1936- """Test trailing whitespace is ignored in included filelist (1 space)"""
1937- fp = StringIO.StringIO("testfiles/select/1/2\n"
1938- "testfiles/select/1 \n"
1939- "testfiles/select/1/2/3\n"
1940- "testfiles/select/3/3/2")
1941- sf = self.Select.filelist_get_sf(fp, 1, "test")
1942- assert sf(self.root) == 1
1943- assert sf(self.makeext("1")) == 1
1944- assert sf(self.makeext("1/1")) is None
1945- assert sf(self.makeext("1/2/3")) == 1
1946- assert sf(self.makeext("2/2")) is None
1947- assert sf(self.makeext("3")) == 1
1948- assert sf(self.makeext("3/3")) == 1
1949- assert sf(self.makeext("3/3/3")) is None
1950-
1951- def test_filelist_include_2_trailing_white_spaces(self):
1952- """Test trailing whitespace is ignored in included filelist (2 space)"""
1953- fp = StringIO.StringIO("testfiles/select/1/2\n"
1954- "testfiles/select/1\n"
1955- "testfiles/select/1/2/3 \n"
1956- "testfiles/select/3/3/2")
1957- sf = self.Select.filelist_get_sf(fp, 1, "test")
1958- assert sf(self.root) == 1
1959- assert sf(self.makeext("1")) == 1
1960- assert sf(self.makeext("1/1")) is None
1961- assert sf(self.makeext("1/2/3")) == 1
1962- assert sf(self.makeext("2/2")) is None
1963- assert sf(self.makeext("3")) == 1
1964- assert sf(self.makeext("3/3")) == 1
1965- assert sf(self.makeext("3/3/3")) is None
1966-
1967- def test_filelist_include_1_leading_white_space(self):
1968- """Test leading whitespace is ignored in included filelist (1 space)"""
1969- fp = StringIO.StringIO(" testfiles/select/1/2\n"
1970- "testfiles/select/1\n"
1971- "testfiles/select/1/2/3\n"
1972- "testfiles/select/3/3/2")
1973- sf = self.Select.filelist_get_sf(fp, 1, "test")
1974- assert sf(self.root) == 1
1975- assert sf(self.makeext("1")) == 1
1976- assert sf(self.makeext("1/1")) is None
1977- assert sf(self.makeext("1/2/3")) == 1
1978- assert sf(self.makeext("2/2")) is None
1979- assert sf(self.makeext("3")) == 1
1980- assert sf(self.makeext("3/3")) == 1
1981- assert sf(self.makeext("3/3/3")) is None
1982-
1983- def test_filelist_include_2_leading_white_spaces(self):
1984- """Test leading whitespace is ignored in included filelist (1 space)"""
1985- fp = StringIO.StringIO("testfiles/select/1/2\n"
1986- "testfiles/select/1\n"
1987- "testfiles/select/1/2/3\n"
1988- " testfiles/select/3/3/2")
1989- sf = self.Select.filelist_get_sf(fp, 1, "test")
1990- assert sf(self.root) == 1
1991- assert sf(self.makeext("1")) == 1
1992- assert sf(self.makeext("1/1")) is None
1993- assert sf(self.makeext("1/2/3")) == 1
1994- assert sf(self.makeext("2/2")) is None
1995- assert sf(self.makeext("3")) == 1
1996- assert sf(self.makeext("3/3")) == 1
1997- assert sf(self.makeext("3/3/3")) is None
1998-
1999- def testFilelistIncludeNullSep(self):
2000- """Test included filelist but with null_separator set"""
2001- fp = StringIO.StringIO("""\0testfiles/select/1/2\0testfiles/select/1\0testfiles/select/1/2/3\0testfiles/select/3/3/2\0testfiles/select/hello\nthere\0""")
2002- self.set_global('null_separator', 1)
2003- sf = self.Select.filelist_get_sf(fp, 1, "test")
2004- assert sf(self.root) == 1
2005- assert sf(self.makeext("1")) == 1
2006- assert sf(self.makeext("1/1")) is None
2007- assert sf(self.makeext("1/2/3")) == 1
2008- assert sf(self.makeext("2/2")) is None
2009- assert sf(self.makeext("3")) == 1
2010- assert sf(self.makeext("3/3")) == 1
2011- assert sf(self.makeext("3/3/3")) is None
2012- assert sf(self.makeext("hello\nthere")) == 1
2013-
2014- def testFilelistExclude(self):
2015- """Test included filelist"""
2016- fp = StringIO.StringIO("""
2017-testfiles/select/1/2
2018-testfiles/select/1
2019-this is a badly formed line which should be ignored
2020-
2021-testfiles/select/1/2/3
2022-testfiles/select/3/3/2""")
2023- sf = self.Select.filelist_get_sf(fp, 0, "test")
2024- assert sf(self.root) is None
2025- assert sf(self.makeext("1")) == 0
2026- assert sf(self.makeext("1/1")) == 0
2027- assert sf(self.makeext("1/2/3")) == 0
2028- assert sf(self.makeext("2/2")) is None
2029- assert sf(self.makeext("3")) is None
2030- assert sf(self.makeext("3/3/2")) == 0
2031- assert sf(self.makeext("3/3/3")) is None
2032-
2033- def testFilelistInclude2(self):
2034- """testFilelistInclude2 - with modifiers"""
2035- fp = StringIO.StringIO("""
2036-testfiles/select/1/1
2037-- testfiles/select/1/2
2038-+ testfiles/select/1/3
2039-- testfiles/select/3""")
2040- sf = self.Select.filelist_get_sf(fp, 1, "test1")
2041- assert sf(self.makeext("1")) == 1
2042- assert sf(self.makeext("1/1")) == 1
2043- assert sf(self.makeext("1/1/2")) is None
2044- assert sf(self.makeext("1/2")) == 0
2045- assert sf(self.makeext("1/2/3")) == 0
2046- assert sf(self.makeext("1/3")) == 1
2047- assert sf(self.makeext("2")) is None
2048- assert sf(self.makeext("3")) == 0
2049-
2050- def testFilelistInclude3(self):
2051- """testFilelistInclude3 - with modifiers to check - works as expected"""
2052- fp = StringIO.StringIO("""
2053-testfiles/select/1/1
2054-- testfiles/select/1/2
2055-+ testfiles/select/1/3
2056-testfiles/select/1""")
2057- sf = self.Select.filelist_get_sf(fp, 1, "test1")
2058- assert sf(self.makeext("1")) == 1
2059- assert sf(self.makeext("1/1")) == 1
2060- assert sf(self.makeext("1/1/2")) is None
2061- assert sf(self.makeext("1/2")) == 0
2062- assert sf(self.makeext("1/2/3")) == 0
2063- assert sf(self.makeext("1/3")) == 1
2064- assert sf(self.makeext("2")) is None
2065- assert sf(self.makeext("3")) is None
2066-
2067-# def test_filelist_include_excluded_folder_with_included_contents(self):
2068-# """Check that excluded folder is included if subfolder is included at higher priority. """
2069-# # ToDo - currently fails. 1/2 should be included (scanned) because 1/2/1 is. Commandline --include/--exclude
2070-# # ToDo - and globbing filelists work this way
2071-# fp = StringIO.StringIO("""
2072-# + testfiles/select/1/2/1
2073-# - testfiles/select/1/2
2074-# + testfiles/select/1/3
2075-# testfiles/select/1""")
2076-# sf = self.Select.filelist_get_sf(fp, 1, "test1")
2077-# assert sf(self.makeext("1")) == 1
2078-# assert sf(self.makeext("1/1")) is None
2079-# assert sf(self.makeext("1/2/1")) == 1
2080-# assert sf(self.makeext("1/2")) == 0 # ToDo - what should this return?
2081-# assert sf(self.makeext("1/2/3")) == 0
2082-# assert sf(self.makeext("1/3")) == 1
2083-# assert sf(self.makeext("2")) is None
2084-# assert sf(self.makeext("3")) is None
2085-
2086- def testFilelistExclude2(self):
2087- """testFilelistExclude2 - with modifiers"""
2088- fp = StringIO.StringIO("""
2089-testfiles/select/1/1
2090-- testfiles/select/1/2
2091-+ testfiles/select/1/3
2092-- testfiles/select/3""")
2093- sf = self.Select.filelist_get_sf(fp, 0, "test1")
2094- sf_val1 = sf(self.root)
2095- assert sf_val1 == 1 or sf_val1 is None # either is OK
2096- sf_val2 = sf(self.makeext("1"))
2097- assert sf_val2 == 1 or sf_val2 is None
2098- assert sf(self.makeext("1/1")) == 0
2099- assert sf(self.makeext("1/1/2")) == 0
2100- assert sf(self.makeext("1/2")) == 0
2101- assert sf(self.makeext("1/2/3")) == 0
2102- assert sf(self.makeext("1/3")) == 1
2103- assert sf(self.makeext("2")) is None
2104- assert sf(self.makeext("3")) == 0
2105-
2106- def test_filelist_exclude_2_with_trailing_white_space(self):
2107- """testFilelistExclude2 with modifiers - test trailing whitespace is ignored (1 and 2 spaces)"""
2108- fp = StringIO.StringIO("testfiles/select/1/1\n"
2109- "- testfiles/select/1/2 \n"
2110- "+ testfiles/select/1/3 \n"
2111- "- testfiles/select/3")
2112- sf = self.Select.filelist_get_sf(fp, 0, "test1")
2113- sf_val1 = sf(self.root)
2114- assert sf_val1 == 1 or sf_val1 is None # either is OK
2115- sf_val2 = sf(self.makeext("1"))
2116- assert sf_val2 == 1 or sf_val2 is None
2117- assert sf(self.makeext("1/1")) == 0
2118- assert sf(self.makeext("1/1/2")) == 0
2119- assert sf(self.makeext("1/2")) == 0
2120- assert sf(self.makeext("1/2/3")) == 0
2121- assert sf(self.makeext("1/3")) == 1
2122- assert sf(self.makeext("2")) is None
2123- assert sf(self.makeext("3")) == 0
2124-
2125- def test_filelist_exclude_with_single_quotes(self):
2126- """testFilelistExclude2 with modifiers - test unnecessary single quotes are ignored"""
2127- fp = StringIO.StringIO("testfiles/select/1/1\n"
2128- "- testfiles/select/1/2\n"
2129- "+ 'testfiles/select/1/3'\n"
2130- "- testfiles/select/3")
2131- sf = self.Select.filelist_get_sf(fp, 0, "test1")
2132- sf_val1 = sf(self.root)
2133- assert sf_val1 == 1 or sf_val1 is None # either is OK
2134- sf_val2 = sf(self.makeext("1"))
2135- assert sf_val2 == 1 or sf_val2 is None
2136- assert sf(self.makeext("1/1")) == 0
2137- assert sf(self.makeext("1/1/2")) == 0
2138- assert sf(self.makeext("1/2")) == 0
2139- assert sf(self.makeext("1/2/3")) == 0
2140- assert sf(self.makeext("1/3")) == 1
2141- assert sf(self.makeext("2")) is None
2142- assert sf(self.makeext("3")) == 0
2143-
2144- def test_filelist_exclude_with_full_line_comment(self):
2145- """testFilelistExclude2 with modifiers - test full-line comment is ignored"""
2146- fp = StringIO.StringIO("testfiles/select/1/1\n"
2147- "- testfiles/select/1/2\n"
2148- "# This is a full-line comment\n"
2149- "+ testfiles/select/1/3\n"
2150- "- testfiles/select/3")
2151- sf = self.Select.filelist_get_sf(fp, 0, "test1")
2152- sf_val1 = sf(self.root)
2153- assert sf_val1 == 1 or sf_val1 is None # either is OK
2154- sf_val2 = sf(self.makeext("1"))
2155- assert sf_val2 == 1 or sf_val2 is None
2156- assert sf(self.makeext("1/1")) == 0
2157- assert sf(self.makeext("1/1/2")) == 0
2158- assert sf(self.makeext("1/2")) == 0
2159- assert sf(self.makeext("1/2/3")) == 0
2160- assert sf(self.makeext("1/3")) == 1
2161- assert sf(self.makeext("2")) is None
2162- assert sf(self.makeext("3")) == 0
2163-
2164- def test_filelist_exclude_with_blank_line(self):
2165- """testFilelistExclude2 with modifiers - test blank line is ignored"""
2166- fp = StringIO.StringIO("testfiles/select/1/1\n"
2167- "- testfiles/select/1/2\n"
2168- "\n"
2169- "+ testfiles/select/1/3\n"
2170- "- testfiles/select/3")
2171- sf = self.Select.filelist_get_sf(fp, 0, "test1")
2172- sf_val1 = sf(self.root)
2173- assert sf_val1 == 1 or sf_val1 is None # either is OK
2174- sf_val2 = sf(self.makeext("1"))
2175- assert sf_val2 == 1 or sf_val2 is None
2176- assert sf(self.makeext("1/1")) == 0
2177- assert sf(self.makeext("1/1/2")) == 0
2178- assert sf(self.makeext("1/2")) == 0
2179- assert sf(self.makeext("1/2/3")) == 0
2180- assert sf(self.makeext("1/3")) == 1
2181- assert sf(self.makeext("2")) is None
2182- assert sf(self.makeext("3")) == 0
2183-
2184- def test_filelist_exclude_with_blank_line_and_whitespace(self):
2185- """testFilelistExclude2 with modifiers - test blank line with whitespace is ignored"""
2186- fp = StringIO.StringIO("testfiles/select/1/1\n"
2187- "- testfiles/select/1/2\n"
2188- " \n"
2189- "+ testfiles/select/1/3\n"
2190- "- testfiles/select/3")
2191- sf = self.Select.filelist_get_sf(fp, 0, "test1")
2192- sf_val1 = sf(self.root)
2193- assert sf_val1 == 1 or sf_val1 is None # either is OK
2194- sf_val2 = sf(self.makeext("1"))
2195- assert sf_val2 == 1 or sf_val2 is None
2196- assert sf(self.makeext("1/1")) == 0
2197- assert sf(self.makeext("1/1/2")) == 0
2198- assert sf(self.makeext("1/2")) == 0
2199- assert sf(self.makeext("1/2/3")) == 0
2200- assert sf(self.makeext("1/3")) == 1
2201- assert sf(self.makeext("2")) is None
2202- assert sf(self.makeext("3")) == 0
2203-
2204- def test_filelist_exclude_with_double_quotes(self):
2205- """testFilelistExclude2 with modifiers - test unnecessary double quotes are ignored"""
2206- fp = StringIO.StringIO('testfiles/select/1/1\n'
2207- '- testfiles/select/1/2\n'
2208- '+ "testfiles/select/1/3"\n'
2209- '- testfiles/select/3')
2210- sf = self.Select.filelist_get_sf(fp, 0, "test1")
2211- sf_val1 = sf(self.root)
2212- assert sf_val1 == 1 or sf_val1 is None # either is OK
2213- sf_val2 = sf(self.makeext("1"))
2214- assert sf_val2 == 1 or sf_val2 is None
2215- assert sf(self.makeext("1/1")) == 0
2216- assert sf(self.makeext("1/1/2")) == 0
2217- assert sf(self.makeext("1/2")) == 0
2218- assert sf(self.makeext("1/2/3")) == 0
2219- assert sf(self.makeext("1/3")) == 1
2220- assert sf(self.makeext("2")) is None
2221- assert sf(self.makeext("3")) == 0
2222-
2223 def testGlobRE(self):
2224 """testGlobRE - test translation of shell pattern to regular exp"""
2225 assert self.Select.glob_to_re("hello") == "hello"
2226@@ -456,12 +151,6 @@
2227 assert select.glob_get_sf("**", 0)(root) == 0
2228 assert select.glob_get_sf("/foo/*", 0)(root) is None
2229
2230- assert select.filelist_get_sf(StringIO.StringIO("/"), 1, "test")(root) == 1
2231- assert select.filelist_get_sf(StringIO.StringIO("/foo/bar"), 1, "test")(root) == 1
2232- assert select.filelist_get_sf(StringIO.StringIO("/"), 0, "test")(root) == 0
2233- assert select.filelist_get_sf(StringIO.StringIO("/foo/bar"), 0,
2234- "test")(root) is None
2235-
2236 def testOtherFilesystems(self):
2237 """Test to see if --exclude-other-filesystems works correctly"""
2238 root = Path("/")
2239@@ -531,9 +220,9 @@
2240 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2241 ('1', '1', '3')])
2242
2243- def test_globbing_filelist(self):
2244+ def test_filelist(self):
2245 """Filelist glob test similar to above testParse2"""
2246- self.ParseTest([("--include-globbing-filelist", "file")],
2247+ self.ParseTest([("--include-filelist", "file")],
2248 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2249 ('1', '1', '3')],
2250 ["- testfiles/select/1/1/1\n"
2251@@ -541,9 +230,9 @@
2252 "- testfiles/select/1\n"
2253 "- **"])
2254
2255- def test_include_globbing_filelist_1_trailing_whitespace(self):
2256+ def test_include_filelist_1_trailing_whitespace(self):
2257 """Filelist glob test similar to globbing filelist, but with 1 trailing whitespace on include"""
2258- self.ParseTest([("--include-globbing-filelist", "file")],
2259+ self.ParseTest([("--include-filelist", "file")],
2260 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2261 ('1', '1', '3')],
2262 ["- testfiles/select/1/1/1\n"
2263@@ -551,9 +240,9 @@
2264 "- testfiles/select/1\n"
2265 "- **"])
2266
2267- def test_include_globbing_filelist_2_trailing_whitespaces(self):
2268+ def test_include_filelist_2_trailing_whitespaces(self):
2269 """Filelist glob test similar to globbing filelist, but with 2 trailing whitespaces on include"""
2270- self.ParseTest([("--include-globbing-filelist", "file")],
2271+ self.ParseTest([("--include-filelist", "file")],
2272 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2273 ('1', '1', '3')],
2274 ["- testfiles/select/1/1/1\n"
2275@@ -561,9 +250,9 @@
2276 "- testfiles/select/1\n"
2277 "- **"])
2278
2279- def test_include_globbing_filelist_1_leading_whitespace(self):
2280+ def test_include_filelist_1_leading_whitespace(self):
2281 """Filelist glob test similar to globbing filelist, but with 1 leading whitespace on include"""
2282- self.ParseTest([("--include-globbing-filelist", "file")],
2283+ self.ParseTest([("--include-filelist", "file")],
2284 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2285 ('1', '1', '3')],
2286 ["- testfiles/select/1/1/1\n"
2287@@ -571,9 +260,9 @@
2288 "- testfiles/select/1\n"
2289 "- **"])
2290
2291- def test_include_globbing_filelist_2_leading_whitespaces(self):
2292+ def test_include_filelist_2_leading_whitespaces(self):
2293 """Filelist glob test similar to globbing filelist, but with 2 leading whitespaces on include"""
2294- self.ParseTest([("--include-globbing-filelist", "file")],
2295+ self.ParseTest([("--include-filelist", "file")],
2296 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2297 ('1', '1', '3')],
2298 ["- testfiles/select/1/1/1\n"
2299@@ -581,9 +270,9 @@
2300 "- testfiles/select/1\n"
2301 "- **"])
2302
2303- def test_include_globbing_filelist_1_trailing_whitespace_exclude(self):
2304+ def test_include_filelist_1_trailing_whitespace_exclude(self):
2305 """Filelist glob test similar to globbing filelist, but with 1 trailing whitespace on exclude"""
2306- self.ParseTest([("--include-globbing-filelist", "file")],
2307+ self.ParseTest([("--include-filelist", "file")],
2308 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2309 ('1', '1', '3')],
2310 ["- testfiles/select/1/1/1 \n"
2311@@ -591,9 +280,9 @@
2312 "- testfiles/select/1\n"
2313 "- **"])
2314
2315- def test_include_globbing_filelist_2_trailing_whitespace_exclude(self):
2316+ def test_include_filelist_2_trailing_whitespace_exclude(self):
2317 """Filelist glob test similar to globbing filelist, but with 2 trailing whitespaces on exclude"""
2318- self.ParseTest([("--include-globbing-filelist", "file")],
2319+ self.ParseTest([("--include-filelist", "file")],
2320 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2321 ('1', '1', '3')],
2322 ["- testfiles/select/1/1/1 \n"
2323@@ -601,9 +290,9 @@
2324 "- testfiles/select/1\n"
2325 "- **"])
2326
2327- def test_include_globbing_filelist_1_leading_whitespace_exclude(self):
2328+ def test_include_filelist_1_leading_whitespace_exclude(self):
2329 """Filelist glob test similar to globbing filelist, but with 1 leading whitespace on exclude"""
2330- self.ParseTest([("--include-globbing-filelist", "file")],
2331+ self.ParseTest([("--include-filelist", "file")],
2332 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2333 ('1', '1', '3')],
2334 [" - testfiles/select/1/1/1\n"
2335@@ -611,9 +300,9 @@
2336 "- testfiles/select/1\n"
2337 "- **"])
2338
2339- def test_include_globbing_filelist_2_leading_whitespaces_exclude(self):
2340+ def test_include_filelist_2_leading_whitespaces_exclude(self):
2341 """Filelist glob test similar to globbing filelist, but with 2 leading whitespaces on exclude"""
2342- self.ParseTest([("--include-globbing-filelist", "file")],
2343+ self.ParseTest([("--include-filelist", "file")],
2344 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2345 ('1', '1', '3')],
2346 [" - testfiles/select/1/1/1\n"
2347@@ -621,9 +310,9 @@
2348 "- testfiles/select/1\n"
2349 "- **"])
2350
2351- def test_include_globbing_filelist_check_excluded_folder_included_for_contents(self):
2352+ def test_include_filelist_check_excluded_folder_included_for_contents(self):
2353 """Filelist glob test to check excluded folder is included if contents are"""
2354- self.ParseTest([("--include-globbing-filelist", "file")],
2355+ self.ParseTest([("--include-filelist", "file")],
2356 [(), ('1',), ('1', '1'), ('1', '1', '1'), ('1', '1', '2'),
2357 ('1', '1', '3'), ('1', '2'), ('1', '2', '1'), ('1', '3'), ('1', '3', '1'), ('1', '3', '2'),
2358 ('1', '3', '3')],
2359@@ -632,9 +321,9 @@
2360 "testfiles/select/1\n"
2361 "- **"])
2362
2363- def test_include_globbing_filelist_with_unnecessary_quotes(self):
2364+ def test_include_filelist_with_unnecessary_quotes(self):
2365 """Filelist glob test similar to globbing filelist, but with quotes around one of the paths."""
2366- self.ParseTest([("--include-globbing-filelist", "file")],
2367+ self.ParseTest([("--include-filelist", "file")],
2368 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2369 ('1', '1', '3')],
2370 ["- 'testfiles/select/1/1/1'\n"
2371@@ -642,9 +331,9 @@
2372 "- testfiles/select/1\n"
2373 "- **"])
2374
2375- def test_include_globbing_filelist_with_unnecessary_double_quotes(self):
2376+ def test_include_filelist_with_unnecessary_double_quotes(self):
2377 """Filelist glob test similar to globbing filelist, but with double quotes around one of the paths."""
2378- self.ParseTest([("--include-globbing-filelist", "file")],
2379+ self.ParseTest([("--include-filelist", "file")],
2380 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2381 ('1', '1', '3')],
2382 ['- "testfiles/select/1/1/1"\n'
2383@@ -652,9 +341,9 @@
2384 '- testfiles/select/1\n'
2385 '- **'])
2386
2387- def test_include_globbing_filelist_with_full_line_comment(self):
2388+ def test_include_filelist_with_full_line_comment(self):
2389 """Filelist glob test similar to globbing filelist, but with a full-line comment."""
2390- self.ParseTest([("--include-globbing-filelist", "file")],
2391+ self.ParseTest([("--include-filelist", "file")],
2392 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2393 ('1', '1', '3')],
2394 ['- testfiles/select/1/1/1\n'
2395@@ -663,9 +352,9 @@
2396 '- testfiles/select/1\n'
2397 '- **'])
2398
2399- def test_include_globbing_filelist_with_blank_line(self):
2400+ def test_include_filelist_with_blank_line(self):
2401 """Filelist glob test similar to globbing filelist, but with a blank line."""
2402- self.ParseTest([("--include-globbing-filelist", "file")],
2403+ self.ParseTest([("--include-filelist", "file")],
2404 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2405 ('1', '1', '3')],
2406 ['- testfiles/select/1/1/1\n'
2407@@ -674,9 +363,9 @@
2408 '- testfiles/select/1\n'
2409 '- **'])
2410
2411- def test_include_globbing_filelist_with_blank_line_and_whitespace(self):
2412+ def test_include_filelist_with_blank_line_and_whitespace(self):
2413 """Filelist glob test similar to globbing filelist, but with a blank line and whitespace."""
2414- self.ParseTest([("--include-globbing-filelist", "file")],
2415+ self.ParseTest([("--include-filelist", "file")],
2416 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2417 ('1', '1', '3')],
2418 ['- testfiles/select/1/1/1\n'
2419@@ -685,19 +374,19 @@
2420 '- testfiles/select/1\n'
2421 '- **'])
2422
2423- def test_include_globbing_filelist_asterisk(self):
2424+ def test_include_filelist_asterisk(self):
2425 """Filelist glob test with * instead of 'testfiles'"""
2426 # Thank you to Elifarley Cruz for this test case
2427 # (https://bugs.launchpad.net/duplicity/+bug/884371).
2428- self.ParseTest([("--include-globbing-filelist", "file")],
2429+ self.ParseTest([("--include-filelist", "file")],
2430 [(), ('1',), ('1', '1'), ('1', '1', '1'),
2431 ('1', '1', '2'), ('1', '1', '3')],
2432 ["*/select/1/1\n"
2433 "- **"])
2434
2435- def test_include_globbing_filelist_asterisk_2(self):
2436- """Identical to test_globbing_filelist, but with the exclude 'select' replaced with '*'"""
2437- self.ParseTest([("--include-globbing-filelist", "file")],
2438+ def test_include_filelist_asterisk_2(self):
2439+ """Identical to test_filelist, but with the exclude 'select' replaced with '*'"""
2440+ self.ParseTest([("--include-filelist", "file")],
2441 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2442 ('1', '1', '3')],
2443 ["- testfiles/*/1/1/1\n"
2444@@ -706,10 +395,10 @@
2445 "- **"])
2446
2447 @unittest.expectedFailure
2448- def test_include_globbing_filelist_asterisk_3(self):
2449- """Identical to test_globbing_filelist, but with the auto-include 'select' replaced with '*'"""
2450+ def test_include_filelist_asterisk_3(self):
2451+ """Identical to test_filelist, but with the auto-include 'select' replaced with '*'"""
2452 # Todo: Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371)
2453- self.ParseTest([("--include-globbing-filelist", "file")],
2454+ self.ParseTest([("--include-filelist", "file")],
2455 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2456 ('1', '1', '3')],
2457 ["- testfiles/select/1/1/1\n"
2458@@ -718,10 +407,10 @@
2459 "- **"])
2460
2461 @unittest.expectedFailure
2462- def test_include_globbing_filelist_asterisk_4(self):
2463- """Identical to test_globbing_filelist, but with a specific include 'select' replaced with '*'"""
2464+ def test_include_filelist_asterisk_4(self):
2465+ """Identical to test_filelist, but with a specific include 'select' replaced with '*'"""
2466 # Todo: Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371)
2467- self.ParseTest([("--include-globbing-filelist", "file")],
2468+ self.ParseTest([("--include-filelist", "file")],
2469 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2470 ('1', '1', '3')],
2471 ["- testfiles/select/1/1/1\n"
2472@@ -730,10 +419,10 @@
2473 "- **"])
2474
2475 @unittest.expectedFailure
2476- def test_include_globbing_filelist_asterisk_5(self):
2477- """Identical to test_globbing_filelist, but with all 'select's replaced with '*'"""
2478+ def test_include_filelist_asterisk_5(self):
2479+ """Identical to test_filelist, but with all 'select's replaced with '*'"""
2480 # Todo: Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371)
2481- self.ParseTest([("--include-globbing-filelist", "file")],
2482+ self.ParseTest([("--include-filelist", "file")],
2483 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2484 ('1', '1', '3')],
2485 ["- testfiles/*/1/1/1\n"
2486@@ -741,9 +430,9 @@
2487 "- testfiles/*/1\n"
2488 "- **"])
2489
2490- def test_include_globbing_filelist_asterisk_6(self):
2491- """Identical to test_globbing_filelist, but with numerous excluded folders replaced with '*'"""
2492- self.ParseTest([("--include-globbing-filelist", "file")],
2493+ def test_include_filelist_asterisk_6(self):
2494+ """Identical to test_filelist, but with numerous excluded folders replaced with '*'"""
2495+ self.ParseTest([("--include-filelist", "file")],
2496 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2497 ('1', '1', '3')],
2498 ["- */*/1/1/1\n"
2499@@ -752,10 +441,10 @@
2500 "- **"])
2501
2502 @unittest.expectedFailure
2503- def test_include_globbing_filelist_asterisk_7(self):
2504- """Identical to test_globbing_filelist, but with numerous included/excluded folders replaced with '*'"""
2505+ def test_include_filelist_asterisk_7(self):
2506+ """Identical to test_filelist, but with numerous included/excluded folders replaced with '*'"""
2507 # Todo: Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371)
2508- self.ParseTest([("--include-globbing-filelist", "file")],
2509+ self.ParseTest([("--include-filelist", "file")],
2510 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2511 ('1', '1', '3')],
2512 ["- */*/1/1/1\n"
2513@@ -763,9 +452,9 @@
2514 "- */*/1\n"
2515 "- **"])
2516
2517- def test_include_globbing_filelist_double_asterisk_1(self):
2518- """Identical to test_globbing_filelist, but with the exclude 'select' replaced with '**'"""
2519- self.ParseTest([("--include-globbing-filelist", "file")],
2520+ def test_include_filelist_double_asterisk_1(self):
2521+ """Identical to test_filelist, but with the exclude 'select' replaced with '**'"""
2522+ self.ParseTest([("--include-filelist", "file")],
2523 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2524 ('1', '1', '3')],
2525 ["- testfiles/**/1/1/1\n"
2526@@ -774,10 +463,10 @@
2527 "- **"])
2528
2529 @unittest.expectedFailure
2530- def test_include_globbing_filelist_double_asterisk_2(self):
2531- """Identical to test_globbing_filelist, but with the include 'select' replaced with '**'"""
2532+ def test_include_filelist_double_asterisk_2(self):
2533+ """Identical to test_filelist, but with the include 'select' replaced with '**'"""
2534 # Todo: Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371)
2535- self.ParseTest([("--include-globbing-filelist", "file")],
2536+ self.ParseTest([("--include-filelist", "file")],
2537 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2538 ('1', '1', '3')],
2539 ["- testfiles/select/1/1/1\n"
2540@@ -785,9 +474,9 @@
2541 "- testfiles/select/1\n"
2542 "- **"])
2543
2544- def test_include_globbing_filelist_double_asterisk_3(self):
2545- """Identical to test_globbing_filelist, but with the exclude 'testfiles/select' replaced with '**'"""
2546- self.ParseTest([("--include-globbing-filelist", "file")],
2547+ def test_include_filelist_double_asterisk_3(self):
2548+ """Identical to test_filelist, but with the exclude 'testfiles/select' replaced with '**'"""
2549+ self.ParseTest([("--include-filelist", "file")],
2550 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2551 ('1', '1', '3')],
2552 ["- **/1/1/1\n"
2553@@ -796,10 +485,10 @@
2554 "- **"])
2555
2556 @unittest.expectedFailure
2557- def test_include_globbing_filelist_double_asterisk_4(self):
2558- """Identical to test_globbing_filelist, but with the include 'testfiles/select' replaced with '**'"""
2559+ def test_include_filelist_double_asterisk_4(self):
2560+ """Identical to test_filelist, but with the include 'testfiles/select' replaced with '**'"""
2561 # Todo: Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371)
2562- self.ParseTest([("--include-globbing-filelist", "file")],
2563+ self.ParseTest([("--include-filelist", "file")],
2564 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2565 ('1', '1', '3')],
2566 ["- testfiles/select/1/1/1\n"
2567@@ -808,10 +497,10 @@
2568 "- **"])
2569
2570 @unittest.expectedFailure
2571- def test_include_globbing_filelist_double_asterisk_5(self):
2572- """Identical to test_globbing_filelist, but with all 'testfiles/select's replaced with '**'"""
2573+ def test_include_filelist_double_asterisk_5(self):
2574+ """Identical to test_filelist, but with all 'testfiles/select's replaced with '**'"""
2575 # Todo: Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371)
2576- self.ParseTest([("--include-globbing-filelist", "file")],
2577+ self.ParseTest([("--include-filelist", "file")],
2578 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2579 ('1', '1', '3')],
2580 ["- **/1/1/1\n"
2581@@ -819,9 +508,9 @@
2582 "- **/1\n"
2583 "- **"])
2584
2585- def test_include_globbing_filelist_trailing_slashes(self):
2586+ def test_include_filelist_trailing_slashes(self):
2587 """Filelist glob test similar to globbing filelist, but with trailing slashes"""
2588- self.ParseTest([("--include-globbing-filelist", "file")],
2589+ self.ParseTest([("--include-filelist", "file")],
2590 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2591 ('1', '1', '3')],
2592 ["- testfiles/select/1/1/1/\n"
2593@@ -830,10 +519,10 @@
2594 "- **"])
2595
2596 @unittest.expectedFailure
2597- def test_include_globbing_filelist_trailing_slashes_and_single_asterisks(self):
2598+ def test_include_filelist_trailing_slashes_and_single_asterisks(self):
2599 """Filelist glob test similar to globbing filelist, but with trailing slashes and single asterisks"""
2600 # Todo: Bug #932482 (https://bugs.launchpad.net/duplicity/+bug/932482)
2601- self.ParseTest([("--include-globbing-filelist", "file")],
2602+ self.ParseTest([("--include-filelist", "file")],
2603 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2604 ('1', '1', '3')],
2605 ["- */select/1/1/1/\n"
2606@@ -842,10 +531,10 @@
2607 "- **"])
2608
2609 @unittest.expectedFailure
2610- def test_include_globbing_filelist_trailing_slashes_and_double_asterisks(self):
2611+ def test_include_filelist_trailing_slashes_and_double_asterisks(self):
2612 """Filelist glob test similar to globbing filelist, but with trailing slashes and double asterisks"""
2613 # Todo: Bug #932482 (https://bugs.launchpad.net/duplicity/+bug/932482)
2614- self.ParseTest([("--include-globbing-filelist", "file")],
2615+ self.ParseTest([("--include-filelist", "file")],
2616 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2617 ('1', '1', '3')],
2618 ["- **/1/1/1/\n"
2619@@ -853,9 +542,18 @@
2620 "- **/1/\n"
2621 "- **"])
2622
2623- def test_exclude_globbing_filelist(self):
2624- """Exclude version of test_globbing_filelist"""
2625- self.ParseTest([("--exclude-globbing-filelist", "file")],
2626+
2627+ def test_filelist_null_separator(self):
2628+ """test_filelist, but with null_separator set"""
2629+ self.set_global('null_separator', 1)
2630+ self.ParseTest([("--include-filelist", "file")],
2631+ [(), ('1',), ('1', '1'), ('1', '1', '2'),
2632+ ('1', '1', '3')],
2633+ ["\0- testfiles/select/1/1/1\0testfiles/select/1/1\0- testfiles/select/1\0- **\0"])
2634+
2635+ def test_exclude_filelist(self):
2636+ """Exclude version of test_filelist"""
2637+ self.ParseTest([("--exclude-filelist", "file")],
2638 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2639 ('1', '1', '3')],
2640 ["testfiles/select/1/1/1\n"
2641@@ -863,17 +561,17 @@
2642 "testfiles/select/1\n"
2643 "- **"])
2644
2645- def test_exclude_globbing_filelist_asterisk_1(self):
2646- """Exclude version of test_include_globbing_filelist_asterisk"""
2647- self.ParseTest([("--exclude-globbing-filelist", "file")],
2648+ def test_exclude_filelist_asterisk_1(self):
2649+ """Exclude version of test_include_filelist_asterisk"""
2650+ self.ParseTest([("--exclude-filelist", "file")],
2651 [(), ('1',), ('1', '1'), ('1', '1', '1'),
2652 ('1', '1', '2'), ('1', '1', '3')],
2653 ["+ */select/1/1\n"
2654 "- **"])
2655
2656- def test_exclude_globbing_filelist_asterisk_2(self):
2657- """Identical to test_exclude_globbing_filelist, but with the exclude 'select' replaced with '*'"""
2658- self.ParseTest([("--exclude-globbing-filelist", "file")],
2659+ def test_exclude_filelist_asterisk_2(self):
2660+ """Identical to test_exclude_filelist, but with the exclude 'select' replaced with '*'"""
2661+ self.ParseTest([("--exclude-filelist", "file")],
2662 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2663 ('1', '1', '3')],
2664 ["testfiles/*/1/1/1\n"
2665@@ -882,10 +580,10 @@
2666 "- **"])
2667
2668 @unittest.expectedFailure
2669- def test_exclude_globbing_filelist_asterisk_3(self):
2670- """Identical to test_exclude_globbing_filelist, but with the include 'select' replaced with '*'"""
2671+ def test_exclude_filelist_asterisk_3(self):
2672+ """Identical to test_exclude_filelist, but with the include 'select' replaced with '*'"""
2673 # Todo: Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371)
2674- self.ParseTest([("--exclude-globbing-filelist", "file")],
2675+ self.ParseTest([("--exclude-filelist", "file")],
2676 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2677 ('1', '1', '3')],
2678 ["testfiles/select/1/1/1\n"
2679@@ -893,9 +591,9 @@
2680 "testfiles/select/1\n"
2681 "- **"])
2682
2683- def test_exclude_globbing_filelist_asterisk_4(self):
2684- """Identical to test_exclude_globbing_filelist, but with numerous excluded folders replaced with '*'"""
2685- self.ParseTest([("--exclude-globbing-filelist", "file")],
2686+ def test_exclude_filelist_asterisk_4(self):
2687+ """Identical to test_exclude_filelist, but with numerous excluded folders replaced with '*'"""
2688+ self.ParseTest([("--exclude-filelist", "file")],
2689 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2690 ('1', '1', '3')],
2691 ["*/select/1/1/1\n"
2692@@ -904,10 +602,10 @@
2693 "- **"])
2694
2695 @unittest.expectedFailure
2696- def test_exclude_globbing_filelist_asterisk_5(self):
2697- """Identical to test_exclude_globbing_filelist, but with numerous included/excluded folders replaced with '*'"""
2698+ def test_exclude_filelist_asterisk_5(self):
2699+ """Identical to test_exclude_filelist, but with numerous included/excluded folders replaced with '*'"""
2700 # Todo: Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371)
2701- self.ParseTest([("--exclude-globbing-filelist", "file")],
2702+ self.ParseTest([("--exclude-filelist", "file")],
2703 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2704 ('1', '1', '3')],
2705 ["*/select/1/1/1\n"
2706@@ -916,10 +614,10 @@
2707 "- **"])
2708
2709 @unittest.expectedFailure
2710- def test_exclude_globbing_filelist_double_asterisk(self):
2711- """Identical to test_exclude_globbing_filelist, but with all included/excluded folders replaced with '**'"""
2712+ def test_exclude_filelist_double_asterisk(self):
2713+ """Identical to test_exclude_filelist, but with all included/excluded folders replaced with '**'"""
2714 # Todo: Bug #884371 (https://bugs.launchpad.net/duplicity/+bug/884371)
2715- self.ParseTest([("--exclude-globbing-filelist", "file")],
2716+ self.ParseTest([("--exclude-filelist", "file")],
2717 [(), ('1',), ('1', '1'), ('1', '1', '2'),
2718 ('1', '1', '3')],
2719 ["**/1/1/1\n"
2720@@ -956,9 +654,9 @@
2721 ('3', '3'),
2722 ('3', '3', '2')])
2723
2724- def test_globbing_filelist2(self):
2725+ def test_filelist2(self):
2726 """Filelist glob test similar to above testGlob"""
2727- self.ParseTest([("--exclude-globbing-filelist", "asoeuth")],
2728+ self.ParseTest([("--exclude-filelist", "asoeuth")],
2729 [(), ('1',), ('1', '1'),
2730 ('1', '1', '1'), ('1', '1', '2'),
2731 ('1', '2'), ('1', '2', '1'), ('1', '2', '2')],
2732@@ -967,7 +665,7 @@
2733 + testfiles/select/1
2734 **
2735 """])
2736- self.ParseTest([("--include-globbing-filelist", "file")],
2737+ self.ParseTest([("--include-filelist", "file")],
2738 [(), ('1',), ('1', '1'),
2739 ('1', '1', '2'),
2740 ('1', '2'),

Subscribers

People subscribed via source and target branches