Add a little more to the svn_rangelist_intersect test to test the
[svn.git] / subversion / tests / cmdline / svndumpfilter_tests.py
blob413530e6ccba1804718399ca9aa1e590afa679d7
1 #!/usr/bin/env python
3 # svndumpfilter_tests.py: testing the 'svndumpfilter' tool.
5 # Subversion is a tool for revision control.
6 # See http://subversion.tigris.org for more information.
8 # ====================================================================
9 # Copyright (c) 2007 CollabNet. All rights reserved.
11 # This software is licensed as described in the file COPYING, which
12 # you should have received as part of this distribution. The terms
13 # are also available at http://subversion.tigris.org/license-1.html.
14 # If newer versions of this license are posted there, you may use a
15 # newer version instead, at your option.
17 ######################################################################
19 # General modules
20 import os
21 import sys
23 # Our testing module
24 import svntest
25 from svntest.verify import SVNExpectedStdout, SVNExpectedStderr
27 # Get some helper routines from svnadmin_tests
28 from svnadmin_tests import load_and_verify_dumpstream, test_create
30 # (abbreviation)
31 Skip = svntest.testcase.Skip
32 SkipUnless = svntest.testcase.SkipUnless
33 XFail = svntest.testcase.XFail
34 Item = svntest.wc.StateItem
37 ######################################################################
38 # Helper routines
41 def filter_and_return_output(dump, *varargs):
42 """Filter the array of lines passed in 'dump' and return the output"""
44 if type(dump) is type(""):
45 dump = [ dump ]
47 ## TODO: Should we need to handle errput?
48 output, errput = \
49 svntest.main.run_command_stdin(
50 svntest.main.svndumpfilter_binary, None, 1, dump, *varargs)
52 return output
55 ######################################################################
56 # Tests
59 def reflect_dropped_renumbered_revs(sbox):
60 "reflect dropped renumbered revs in svn:mergeinfo"
62 ## See http://subversion.tigris.org/issues/show_bug.cgi?id=2982. ##
64 # Test svndumpfilter with include option
65 test_create(sbox)
66 dumpfile_location = os.path.join(os.path.dirname(sys.argv[0]),
67 'svndumpfilter_tests_data',
68 'with_merges.dump')
69 dumpfile = svntest.main.file_read(dumpfile_location)
71 filtered_out = filter_and_return_output(dumpfile, "include",
72 "trunk", "branch1",
73 "--skip-missing-merge-sources",
74 "--drop-empty-revs",
75 "--renumber-revs", "--quiet")
76 load_and_verify_dumpstream(sbox, [], [], None, filtered_out)
78 # Verify the svn:mergeinfo properties
79 svntest.actions.run_and_verify_svn(None,
80 [sbox.repo_url+"/trunk - /branch1:4-5\n"],
81 [], 'propget', 'svn:mergeinfo', '-R',
82 sbox.repo_url + '/trunk')
83 svntest.actions.run_and_verify_svn(None,
84 [sbox.repo_url+"/branch1 - /trunk:1-2\n"],
85 [], 'propget', 'svn:mergeinfo', '-R',
86 sbox.repo_url + '/branch1')
88 # Test svndumpfilter with exclude option
89 test_create(sbox)
90 filtered_out = filter_and_return_output(dumpfile, "exclude",
91 "branch1",
92 "--skip-missing-merge-sources",
93 "--drop-empty-revs",
94 "--renumber-revs", "--quiet")
95 load_and_verify_dumpstream(sbox, [], [], None, filtered_out)
97 # Verify the svn:mergeinfo properties
98 svntest.actions.run_and_verify_svn(None,
99 [sbox.repo_url+"/trunk - \n"],
100 [], 'propget', 'svn:mergeinfo', '-R',
101 sbox.repo_url + '/trunk')
102 svntest.actions.run_and_verify_svn(None,
103 [sbox.repo_url+"/branch2 - /trunk:1-2\n"],
104 [], 'propget', 'svn:mergeinfo', '-R',
105 sbox.repo_url + '/branch2')
108 ########################################################################
109 # Run the tests
112 # list all tests here, starting with None:
113 test_list = [ None,
114 reflect_dropped_renumbered_revs,
117 if __name__ == '__main__':
118 svntest.main.run_tests(test_list)
119 # NOTREACHED
122 ### End of file.