Mercurial > hgsubversion
comparison tests/test_single_dir_clone.py @ 869:db3a651494f9
test_util: pass repo_path to svnls(), turn it into a function
author | Patrick Mezard <patrick@mezard.eu> |
---|---|
date | Thu, 19 Apr 2012 18:29:30 +0200 |
parents | cc1c870f1758 |
children | 51fd75ae62b9 |
comparison
equal
deleted
inserted
replaced
868:cc1c870f1758 | 869:db3a651494f9 |
---|---|
78 test = 4 | 78 test = 4 |
79 self.assertEqual(self.repo[test]['.hgsvnexternals'].data(), expect) | 79 self.assertEqual(self.repo[test]['.hgsvnexternals'].data(), expect) |
80 | 80 |
81 def test_push_single_dir(self): | 81 def test_push_single_dir(self): |
82 # Tests simple pushing from default branch to a single dir repo | 82 # Tests simple pushing from default branch to a single dir repo |
83 repo = self._load_fixture_and_fetch('branch_from_tag.svndump', | 83 repo, repo_path = self.load_and_fetch('branch_from_tag.svndump', |
84 stupid=False, | 84 stupid=False, |
85 layout='single', | 85 layout='single', |
86 subdir='') | 86 subdir='') |
87 def file_callback(repo, memctx, path): | 87 def file_callback(repo, memctx, path): |
88 if path == 'adding_file': | 88 if path == 'adding_file': |
89 return context.memfilectx(path=path, | 89 return context.memfilectx(path=path, |
90 data='foo', | 90 data='foo', |
91 islink=False, | 91 islink=False, |
107 '2009-10-19 18:49:30 -0500', | 107 '2009-10-19 18:49:30 -0500', |
108 {'branch': 'default', }) | 108 {'branch': 'default', }) |
109 repo.commitctx(ctx) | 109 repo.commitctx(ctx) |
110 hg.update(repo, repo['tip'].node()) | 110 hg.update(repo, repo['tip'].node()) |
111 self.pushrevisions() | 111 self.pushrevisions() |
112 self.assertTrue('adding_file' in self.svnls('')) | 112 self.assertTrue('adding_file' in test_util.svnls(repo_path, '')) |
113 self.assertEqual('application/octet-stream', | 113 self.assertEqual('application/octet-stream', |
114 self.svnpropget('adding_binary', 'svn:mime-type')) | 114 self.svnpropget('adding_binary', 'svn:mime-type')) |
115 # Now add another commit and test mime-type being reset | 115 # Now add another commit and test mime-type being reset |
116 changes = [('adding_binary', 'adding_binary', 'no longer binary')] | 116 changes = [('adding_binary', 'adding_binary', 'no longer binary')] |
117 self.commitchanges(changes) | 117 self.commitchanges(changes) |
173 '2009-10-19 18:49:30 -0500', | 173 '2009-10-19 18:49:30 -0500', |
174 {'branch': 'default', }) | 174 {'branch': 'default', }) |
175 repo.commitctx(ctx) | 175 repo.commitctx(ctx) |
176 hg.update(repo, repo['tip'].node()) | 176 hg.update(repo, repo['tip'].node()) |
177 self.pushrevisions(expected_extra_back=1) | 177 self.pushrevisions(expected_extra_back=1) |
178 self.assertTrue('trunk/one' in self.svnls('')) | 178 self.assertTrue('trunk/one' in test_util.svnls(repo_path, '')) |
179 self.assertTrue('trunk/two' in self.svnls('')) | 179 self.assertTrue('trunk/two' in test_util.svnls(repo_path, '')) |
180 | 180 |
181 def test_push_single_dir_branch(self): | 181 def test_push_single_dir_branch(self): |
182 # Tests local branches pushing to a single dir repo. Creates a fork at | 182 # Tests local branches pushing to a single dir repo. Creates a fork at |
183 # tip. The default branch adds a file called default, while branch foo | 183 # tip. The default branch adds a file called default, while branch foo |
184 # adds a file called foo, then tries to push the foo branch and default | 184 # adds a file called foo, then tries to push the foo branch and default |
185 # branch in that order. | 185 # branch in that order. |
186 repo = self._load_fixture_and_fetch('branch_from_tag.svndump', | 186 repo, repo_path = self.load_and_fetch('branch_from_tag.svndump', |
187 stupid=False, | 187 stupid=False, |
188 layout='single', | 188 layout='single', |
189 subdir='') | 189 subdir='') |
190 def file_callback(data): | 190 def file_callback(data): |
191 def cb(repo, memctx, path): | 191 def cb(repo, memctx, path): |
192 if path == data: | 192 if path == data: |
193 return context.memfilectx(path=path, | 193 return context.memfilectx(path=path, |
194 data=data, | 194 data=data, |
212 commit_to_branch('default', parent) | 212 commit_to_branch('default', parent) |
213 commit_to_branch('foo', parent) | 213 commit_to_branch('foo', parent) |
214 hg.update(repo, repo['foo'].node()) | 214 hg.update(repo, repo['foo'].node()) |
215 self.pushrevisions() | 215 self.pushrevisions() |
216 repo = self.repo # repo is outdated after the rebase happens, refresh | 216 repo = self.repo # repo is outdated after the rebase happens, refresh |
217 self.assertTrue('foo' in self.svnls('')) | 217 self.assertTrue('foo' in test_util.svnls(repo_path, '')) |
218 self.assertEqual(repo.branchtags().keys(), ['default']) | 218 self.assertEqual(repo.branchtags().keys(), ['default']) |
219 # Have to cross to another branch head, so hg.update doesn't work | 219 # Have to cross to another branch head, so hg.update doesn't work |
220 commands.update(ui.ui(), | 220 commands.update(ui.ui(), |
221 self.repo, | 221 self.repo, |
222 self.repo.branchheads('default')[1], | 222 self.repo.branchheads('default')[1], |
223 clean=True) | 223 clean=True) |
224 self.pushrevisions() | 224 self.pushrevisions() |
225 self.assertTrue('default' in self.svnls('')) | 225 self.assertTrue('default' in test_util.svnls(repo_path, '')) |
226 self.assertEquals(len(self.repo.branchheads('default')), 1) | 226 self.assertEquals(len(self.repo.branchheads('default')), 1) |
227 | 227 |
228 @test_util.requiresoption('branch') | 228 @test_util.requiresoption('branch') |
229 def test_push_single_dir_renamed_branch(self, stupid=False): | 229 def test_push_single_dir_renamed_branch(self, stupid=False): |
230 # Tests pulling and pushing with a renamed branch | 230 # Tests pulling and pushing with a renamed branch |
253 '2009-10-19 18:49:30 -0500', | 253 '2009-10-19 18:49:30 -0500', |
254 {'branch': 'default', }) | 254 {'branch': 'default', }) |
255 self.repo.commitctx(ctx) | 255 self.repo.commitctx(ctx) |
256 hg.update(self.repo, self.repo['tip'].node()) | 256 hg.update(self.repo, self.repo['tip'].node()) |
257 self.pushrevisions() | 257 self.pushrevisions() |
258 self.assertTrue('adding_file' in self.svnls('')) | 258 self.assertTrue('adding_file' in test_util.svnls(repo_path, '')) |
259 | 259 |
260 self.assertEquals(set(['flaf']), | 260 self.assertEquals(set(['flaf']), |
261 set(self.repo[i].branch() for i in self.repo)) | 261 set(self.repo[i].branch() for i in self.repo)) |
262 | 262 |
263 @test_util.requiresoption('branch') | 263 @test_util.requiresoption('branch') |