Mercurial > hgsubversion
comparison tests/test_single_dir_clone.py @ 701:3b8088de027d
clone: replace the --singlebranch with overloading for --branch
Instead of adding yet another option, we take the --branch option to
mean the resulting branch name. It's stored in the branch map.
| author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
|---|---|
| date | Thu, 23 Sep 2010 16:54:27 +0200 |
| parents | a45365f1492a |
| children | 1041fb1bec8c |
comparison
equal
deleted
inserted
replaced
| 700:04b3f476e2c3 | 701:3b8088de027d |
|---|---|
| 2 | 2 |
| 3 import errno | 3 import errno |
| 4 import shutil | 4 import shutil |
| 5 import unittest | 5 import unittest |
| 6 | 6 |
| 7 from mercurial import dispatch | |
| 7 from mercurial import commands | 8 from mercurial import commands |
| 8 from mercurial import context | 9 from mercurial import context |
| 9 from mercurial import hg | 10 from mercurial import hg |
| 10 from mercurial import node | 11 from mercurial import node |
| 11 from mercurial import ui | 12 from mercurial import ui |
| 210 clean=True) | 211 clean=True) |
| 211 self.pushrevisions() | 212 self.pushrevisions() |
| 212 self.assertTrue('default' in self.svnls('')) | 213 self.assertTrue('default' in self.svnls('')) |
| 213 self.assertEquals(len(self.repo.branchheads('default')), 1) | 214 self.assertEquals(len(self.repo.branchheads('default')), 1) |
| 214 | 215 |
| 216 def test_push_single_dir_renamed_branch(self, stupid=False): | |
| 217 # Tests pulling and pushing with a renamed branch | |
| 218 # Based on test_push_single_dir | |
| 219 test_util.load_svndump_fixture(self.repo_path, | |
| 220 'branch_from_tag.svndump') | |
| 221 cmd = ['clone', '--layout=single', '--branch=flaf'] | |
| 222 if stupid: | |
| 223 cmd.append('--stupid') | |
| 224 cmd += [test_util.fileurl(self.repo_path), self.wc_path] | |
| 225 dispatch.dispatch(cmd) | |
| 226 | |
| 227 def file_callback(repo, memctx, path): | |
| 228 if path == 'adding_file': | |
| 229 return context.memfilectx(path=path, | |
| 230 data='foo', | |
| 231 islink=False, | |
| 232 isexec=False, | |
| 233 copied=False) | |
| 234 raise IOError(errno.EINVAL, 'Invalid operation: ' + path) | |
| 235 ctx = context.memctx(self.repo, | |
| 236 (self.repo['tip'].node(), node.nullid), | |
| 237 'automated test', | |
| 238 ['adding_file'], | |
| 239 file_callback, | |
| 240 'an_author', | |
| 241 '2009-10-19 18:49:30 -0500', | |
| 242 {'branch': 'default',}) | |
| 243 self.repo.commitctx(ctx) | |
| 244 hg.update(self.repo, self.repo['tip'].node()) | |
| 245 self.pushrevisions() | |
| 246 self.assertTrue('adding_file' in self.svnls('')) | |
| 247 | |
| 248 self.assertEquals(set(['flaf']), | |
| 249 set(self.repo[i].branch() for i in self.repo)) | |
| 250 | |
| 251 def test_push_single_dir_renamed_branch_stupid(self): | |
| 252 self.test_push_single_dir_renamed_branch(True) | |
| 253 | |
| 215 def suite(): | 254 def suite(): |
| 216 all = [unittest.TestLoader().loadTestsFromTestCase(TestSingleDir)] | 255 all = [unittest.TestLoader().loadTestsFromTestCase(TestSingleDir)] |
| 217 return unittest.TestSuite(all) | 256 return unittest.TestSuite(all) |
