comparison tests/test_single_dir_push.py @ 1075:cf325cd90b22

test_single_dir_push: use stupid mode metaclass
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Fri, 09 Aug 2013 23:46:01 +0200
parents 2d7398fffd0d
children 6e1dbf6cbc92
comparison
equal deleted inserted replaced
1074:2668785264d7 1075:cf325cd90b22
9 from mercurial import hg 9 from mercurial import hg
10 from mercurial import node 10 from mercurial import node
11 from mercurial import ui 11 from mercurial import ui
12 12
13 class TestSingleDirPush(test_util.TestBase): 13 class TestSingleDirPush(test_util.TestBase):
14 stupid_mode_tests = True
14 obsolete_mode_tests = True 15 obsolete_mode_tests = True
15 16
16 def test_push_single_dir(self): 17 def test_push_single_dir(self):
17 # Tests simple pushing from default branch to a single dir repo 18 # Tests simple pushing from default branch to a single dir repo
18 repo, repo_path = self.load_and_fetch('branch_from_tag.svndump', 19 repo, repo_path = self.load_and_fetch('branch_from_tag.svndump',
19 stupid=False,
20 layout='single', 20 layout='single',
21 subdir='') 21 subdir='')
22 def file_callback(repo, memctx, path): 22 def file_callback(repo, memctx, path):
23 if path == 'adding_file': 23 if path == 'adding_file':
24 return context.memfilectx(path=path, 24 return context.memfilectx(path=path,
55 self.assertEqual('', test_util.svnpropget(repo_path, 'adding_binary', 55 self.assertEqual('', test_util.svnpropget(repo_path, 'adding_binary',
56 'svn:mime-type')) 56 'svn:mime-type'))
57 57
58 def test_push_single_dir_at_subdir(self): 58 def test_push_single_dir_at_subdir(self):
59 repo = self._load_fixture_and_fetch('branch_from_tag.svndump', 59 repo = self._load_fixture_and_fetch('branch_from_tag.svndump',
60 stupid=False,
61 layout='single', 60 layout='single',
62 subdir='trunk') 61 subdir='trunk')
63 def filectxfn(repo, memctx, path): 62 def filectxfn(repo, memctx, path):
64 return context.memfilectx(path=path, 63 return context.memfilectx(path=path,
65 data='contents of %s' % path, 64 data='contents of %s' % path,
88 # Tests simple pushing from default branch to a single dir repo 87 # Tests simple pushing from default branch to a single dir repo
89 # Pushes two outgoing over one incoming svn rev 88 # Pushes two outgoing over one incoming svn rev
90 # (used to cause an "unknown revision") 89 # (used to cause an "unknown revision")
91 # This can happen if someone committed to svn since our last pull (race). 90 # This can happen if someone committed to svn since our last pull (race).
92 repo, repo_path = self.load_and_fetch('branch_from_tag.svndump', 91 repo, repo_path = self.load_and_fetch('branch_from_tag.svndump',
93 stupid=False,
94 layout='single', 92 layout='single',
95 subdir='trunk') 93 subdir='trunk')
96 self.add_svn_rev(repo_path, {'trunk/alpha': 'Changed'}) 94 self.add_svn_rev(repo_path, {'trunk/alpha': 'Changed'})
97 def file_callback(repo, memctx, path): 95 def file_callback(repo, memctx, path):
98 return context.memfilectx(path=path, 96 return context.memfilectx(path=path,
119 # Tests local branches pushing to a single dir repo. Creates a fork at 117 # Tests local branches pushing to a single dir repo. Creates a fork at
120 # tip. The default branch adds a file called default, while branch foo 118 # tip. The default branch adds a file called default, while branch foo
121 # adds a file called foo, then tries to push the foo branch and default 119 # adds a file called foo, then tries to push the foo branch and default
122 # branch in that order. 120 # branch in that order.
123 repo, repo_path = self.load_and_fetch('branch_from_tag.svndump', 121 repo, repo_path = self.load_and_fetch('branch_from_tag.svndump',
124 stupid=False,
125 layout='single', 122 layout='single',
126 subdir='') 123 subdir='')
127 def file_callback(data): 124 def file_callback(data):
128 def cb(repo, memctx, path): 125 def cb(repo, memctx, path):
129 if path == data: 126 if path == data:
161 self.pushrevisions() 158 self.pushrevisions()
162 self.assertTrue('default' in test_util.svnls(repo_path, '')) 159 self.assertTrue('default' in test_util.svnls(repo_path, ''))
163 self.assertEquals(len(self.repo.branchheads('default')), 1) 160 self.assertEquals(len(self.repo.branchheads('default')), 1)
164 161
165 @test_util.requiresoption('branch') 162 @test_util.requiresoption('branch')
166 def test_push_single_dir_renamed_branch(self, stupid=False): 163 def test_push_single_dir_renamed_branch(self):
167 # Tests pulling and pushing with a renamed branch 164 # Tests pulling and pushing with a renamed branch
168 # Based on test_push_single_dir 165 # Based on test_push_single_dir
169 repo_path = self.load_svndump('branch_from_tag.svndump') 166 repo_path = self.load_svndump('branch_from_tag.svndump')
170 cmd = ['clone', '--layout=single', '--branch=flaf'] 167 cmd = ['clone', '--layout=single', '--branch=flaf']
171 if stupid: 168 if self.stupid:
172 cmd.append('--stupid') 169 cmd.append('--stupid')
173 cmd += [test_util.fileurl(repo_path), self.wc_path] 170 cmd += [test_util.fileurl(repo_path), self.wc_path]
174 test_util.dispatch(cmd) 171 test_util.dispatch(cmd)
175 172
176 def file_callback(repo, memctx, path): 173 def file_callback(repo, memctx, path):
194 self.pushrevisions() 191 self.pushrevisions()
195 self.assertTrue('adding_file' in test_util.svnls(repo_path, '')) 192 self.assertTrue('adding_file' in test_util.svnls(repo_path, ''))
196 193
197 self.assertEquals(set(['flaf']), 194 self.assertEquals(set(['flaf']),
198 set(self.repo[i].branch() for i in self.repo)) 195 set(self.repo[i].branch() for i in self.repo))
199
200 @test_util.requiresoption('branch')
201 def test_push_single_dir_renamed_branch_stupid(self):
202 self.test_push_single_dir_renamed_branch(True)