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 ######################################################################
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
31 Skip
= svntest
.testcase
.Skip
32 SkipUnless
= svntest
.testcase
.SkipUnless
33 XFail
= svntest
.testcase
.XFail
34 Item
= svntest
.wc
.StateItem
37 ######################################################################
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(""):
47 ## TODO: Should we need to handle errput?
49 svntest
.main
.run_command_stdin(
50 svntest
.main
.svndumpfilter_binary
, None, 1, dump
, *varargs
)
55 ######################################################################
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
66 dumpfile_location
= os
.path
.join(os
.path
.dirname(sys
.argv
[0]),
67 'svndumpfilter_tests_data',
69 dumpfile
= svntest
.main
.file_read(dumpfile_location
)
71 filtered_out
= filter_and_return_output(dumpfile
, "include",
73 "--skip-missing-merge-sources",
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
90 filtered_out
= filter_and_return_output(dumpfile
, "exclude",
92 "--skip-missing-merge-sources",
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 ########################################################################
112 # list all tests here, starting with None:
114 reflect_dropped_renumbered_revs
,
117 if __name__
== '__main__':
118 svntest
.main
.run_tests(test_list
)