annotate tests/test_push_autoprops.py @ 1382:d996850ac4e8

maps: call super directly instead of self.super In the next few patches, we're going to remove self.super because it isn't reliable for calling up the parent chain. Instead, we'll save ourselves the headache and change it now.
author Sean Farley <sean.michael.farley@gmail.com>
date Mon, 24 Mar 2014 11:20:58 -0500
parents 6aad12ea6d9f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
911
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
1 import subprocess
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
2 import sys
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
3 import unittest
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
4 import os
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
5
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
6 import test_util
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
7
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
8 from hgsubversion import svnwrap
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
9
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
10 class PushAutoPropsTests(test_util.TestBase):
1055
2d7398fffd0d push: obsolete rather than rebase & strip when enabled
Dan Villiom Podlaski Christiansen <dan@cabo.dk>
parents: 1044
diff changeset
11 obsolete_mode_tests = True
2d7398fffd0d push: obsolete rather than rebase & strip when enabled
Dan Villiom Podlaski Christiansen <dan@cabo.dk>
parents: 1044
diff changeset
12
911
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
13 def setUp(self):
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
14 test_util.TestBase.setUp(self)
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
15 repo, self.repo_path = self.load_and_fetch('emptyrepo.svndump')
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
16
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
17 def test_push_honors_svn_autoprops(self):
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
18 self.setup_svn_config(
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
19 "[miscellany]\n"
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
20 "enable-auto-props = yes\n"
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
21 "[auto-props]\n"
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
22 "*.py = test:prop=success\n")
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
23 changes = [('test.py', 'test.py', 'echo hallo')]
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
24 self.commitchanges(changes)
1070
6aad12ea6d9f test_push_autoprops: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 1055
diff changeset
25 self.pushrevisions()
911
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
26 prop_val = test_util.svnpropget(
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
27 self.repo_path, "trunk/test.py", 'test:prop')
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
28 self.assertEqual('success', prop_val)
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
29
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
30
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
31 class AutoPropsConfigTest(test_util.TestBase):
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
32 def test_use_autoprops_for_matching_file_when_enabled(self):
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
33 self.setup_svn_config(
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
34 "[miscellany]\n"
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
35 "enable-auto-props = yes\n"
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
36 "[auto-props]\n"
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
37 "*.py = test:prop=success\n")
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
38 props = self.new_autoprops_config().properties('xxx/test.py')
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
39 self.assertEqual({ 'test:prop': 'success'}, props)
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
40
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
41 def new_autoprops_config(self):
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
42 return svnwrap.AutoPropsConfig(self.config_dir)
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
43
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
44 def test_ignore_nonexisting_config(self):
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
45 config_file = os.path.join(self.config_dir, 'config')
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
46 os.remove(config_file)
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
47 self.assertTrue(not os.path.exists(config_file))
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
48 props = self.new_autoprops_config().properties('xxx/test.py')
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
49 self.assertEqual({}, props)
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
50
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
51 def test_ignore_autoprops_when_file_doesnt_match(self):
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
52 self.setup_svn_config(
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
53 "[miscellany]\n"
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
54 "enable-auto-props = yes\n"
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
55 "[auto-props]\n"
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
56 "*.py = test:prop=success\n")
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
57 props = self.new_autoprops_config().properties('xxx/test.sh')
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
58 self.assertEqual({}, props)
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
59
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
60 def test_ignore_autoprops_when_disabled(self):
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
61 self.setup_svn_config(
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
62 "[miscellany]\n"
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
63 "#enable-auto-props = yes\n"
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
64 "[auto-props]\n"
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
65 "*.py = test:prop=success\n")
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
66 props = self.new_autoprops_config().properties('xxx/test.py')
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
67 self.assertEqual({}, props)
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
68
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
69 def test_combine_properties_of_multiple_matches(self):
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
70 self.setup_svn_config(
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
71 "[miscellany]\n"
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
72 "enable-auto-props = yes\n"
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
73 "[auto-props]\n"
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
74 "*.py = test:prop=success\n"
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
75 "test.* = test:prop2=success\n")
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
76 props = self.new_autoprops_config().properties('xxx/test.py')
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
77 self.assertEqual({
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
78 'test:prop': 'success', 'test:prop2': 'success'}, props)
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
79
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
80
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
81 class ParseAutoPropsTests(test_util.TestBase):
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
82 def test_property_value_is_optional(self):
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
83 props = svnwrap.parse_autoprops("svn:executable")
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
84 self.assertEqual({'svn:executable': ''}, props)
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
85 props = svnwrap.parse_autoprops("svn:executable=")
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
86 self.assertEqual({'svn:executable': ''}, props)
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
87
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
88 def test_property_value_may_be_quoted(self):
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
89 props = svnwrap.parse_autoprops("svn:eol-style=\" native \"")
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
90 self.assertEqual({'svn:eol-style': ' native '}, props)
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
91 props = svnwrap.parse_autoprops("svn:eol-style=' native '")
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
92 self.assertEqual({'svn:eol-style': ' native '}, props)
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
93
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
94 def test_surrounding_whitespaces_are_ignored(self):
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
95 props = svnwrap.parse_autoprops(" svn:eol-style = native ")
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
96 self.assertEqual({'svn:eol-style': 'native'}, props)
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
97
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
98 def test_multiple_properties_are_separated_by_semicolon(self):
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
99 props = svnwrap.parse_autoprops(
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
100 "svn:eol-style=native;svn:executable=true\n")
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
101 self.assertEqual({
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
102 'svn:eol-style': 'native',
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
103 'svn:executable': 'true'},
772280aed751 Honor SVN auto-props (solves issue #186)
Ronny Voelker <ronny.voelker@googlemail.com>
parents:
diff changeset
104 props)