Ejemplo n.º 1
0
 def test_custom_trunk(self):
     config = Config([
         '/repo/path', 'a/b', '--trunk-dir', 'bla', '--tag-or-branch-dir',
         'blub'
     ])
     self.assertFalse(config.is_path_tag_or_branch('bla/branches/bar'))
     self.assertFalse(config.is_path_tag_or_branch('blub/branches/bar'))
     self.assertFalse(config.is_path_tag_or_branch('trunk/branches/bar'))
Ejemplo n.º 2
0
 def setUp(self):
     self.config = Config(['/repo'])
     self.repo = RepositoryMock()
     self.writer = DumpWriterMock(self)
     self.interesting_paths = InterestingPaths()
     self.builder = LumpBuilder(self.config, self.repo,
                                self.interesting_paths, self.writer)
Ejemplo n.º 3
0
 def test_include_file_plus(self):
     (fh) = tempfile.NamedTemporaryFile(delete=False)
     fh.write("a/x\nb/y\nc/z\n")
     fh.close()
     config = Config(['/repo/path', '--include-file', fh.name, 'x/y'])
     self.assertEqual(sorted(config.include_paths),
                      ['a/x', 'b/y', 'c/z', 'x/y'])
     self.assertEqual(config.exclude_paths, [])
     os.remove(fh.name)
Ejemplo n.º 4
0
 def test_exclude_file_plus(self):
     (fh) = tempfile.NamedTemporaryFile(delete=False)
     fh.write("x1\nx2\n")
     fh.close()
     config = Config([
         '/repo/path', 'a/b/c', '--exclude-file', fh.name, '--exclude',
         'x/y'
     ])
     self.assertEqual(config.include_paths, ['a/b/c'])
     self.assertEqual(sorted(config.exclude_paths), ['x/y', 'x1', 'x2'])
     os.remove(fh.name)
Ejemplo n.º 5
0
 def setUp(self):
     self.config = Config([ '/dummy' ])
     self.interesting_paths = InterestingPaths()
     self.repo = RepositoryMock()
     self.builder = LumpBuilderMock()
     self.dump_filter = DumpFilter(
         config = self.config,
         source_repository = self.repo,
         interesting_paths = self.interesting_paths,
         lump_builder = self.builder
     )
Ejemplo n.º 6
0
 def setUp(self):
     self.config = Config(['/dummy'])
     self.interesting_paths = InterestingPaths()
     self.repo = RepositoryMock()
     self.repo.revision_properties_by_revision[3] = [
         'some author', 'some date', 'same log message'
     ]
     self.builder = LumpBuilderMock()
     self.boots_trapper = BootsTrapper(
         config=self.config,
         source_repository=self.repo,
         interesting_paths=self.interesting_paths,
         lump_builder=self.builder)
Ejemplo n.º 7
0
 def test_custom_tag_and_branches(self):
     config = Config([
         '/repo/path', 'a/b', '--tag-or-branch-dir', 'bla',
         '--tag-or-branch-dir', 'branches'
     ])
     self.assertTrue(config.is_path_tag_or_branch('foo/bla/bar'))
     self.assertTrue(config.is_path_tag_or_branch('foo/branches/bar'))
     self.assertFalse(config.is_path_tag_or_branch('foo/trunk/bar'))
     self.assertFalse(config.is_path_tag_or_branch('foo/tags/bar'))
Ejemplo n.º 8
0
 def setUp(self):
     self.config = Config(['/dummy'])
     self.interesting_paths = InterestingPathMock()
     self.repo = SvnRepositoryMock()
     handler_map = {}
     for strategy in [
             STRATEGY_DUMP_HEADER, STRATEGY_IGNORE,
             STRATEGY_SYNTHETIC_DELETES, STRATEGY_DUMP_SCAN,
             STRATEGY_BOOTSTRAP
     ]:
         handler_map[strategy] = RevsionHandlerMock(strategy, self)
     self.controller = DumpController(self.config, self.repo,
                                      self.interesting_paths, handler_map)
     self.process_log = []
     self.aux_data_by_rev = {}
Ejemplo n.º 9
0
 def test_q(self):
     config = Config(['/repo/path', 'a/b', '-q'])
     self.assertEqual(config.quiet, True)
Ejemplo n.º 10
0
 def setUp(self):
     self.config = Config( [ '--no-extra-mkdirs', '/dummy' ] )
     self.writer = DumpWriterMock(self)
     self.revision_mapper = RevisionMapper(self.config)
     self.processor = LumpPostProcessor(self.config, self.revision_mapper, self.writer)
     self.processor.parent_directory_lump_generator = ParentDirectoryGeneratorMock(self.processor)
Ejemplo n.º 11
0
 def test_custom_tag_and_branches(self):
     config = Config(['/repo/path', 'a/b', '--tag-or-branch-dir', 'bla', '--tag-or-branch-dir', 'branches'])
     self.assertTrue(config.is_path_tag_or_branch('foo/bla/bar'))
     self.assertTrue(config.is_path_tag_or_branch('foo/branches/bar'))
     self.assertFalse(config.is_path_tag_or_branch('foo/trunk/bar'))
     self.assertFalse(config.is_path_tag_or_branch('foo/tags/bar'))
Ejemplo n.º 12
0
    def test_simple_args(self):
        config = Config(['/repo/path', 'a/b/c', 'x/y'])
        self.assertEqual(config.source_repository, '/repo/path')
        self.assertEqual(sorted(config.include_paths), ['a/b/c', 'x/y'])
        self.assertEqual(config.exclude_paths, [])
        self.assertEqual(config.keep_empty_revs, False)
        self.assertEqual(config.start_rev, None)
        self.assertEqual(config.quiet, False)
        self.assertEqual(config.log_file, None)
        self.assertEqual(config.create_parent_dirs, True)
        self.assertEqual(config.drop_old_tags_and_branches, False)

        self.assertTrue(config.is_path_tag_or_branch('tags/something'))
        self.assertTrue(config.is_path_tag_or_branch('prefix/tags/something'))
        self.assertTrue(config.is_path_tag_or_branch('blub/branches/bla'))

        self.assertFalse(config.is_path_tag_or_branch('blub/branches'))
        self.assertFalse(config.is_path_tag_or_branch('trunk'))
        self.assertFalse(config.is_path_tag_or_branch('bla'))
        self.assertFalse(config.is_path_tag_or_branch('tags'))
        self.assertFalse(config.is_path_tag_or_branch('tags/'))
        self.assertFalse(config.is_path_tag_or_branch('tagsX/something'))
        self.assertFalse(config.is_path_tag_or_branch('prefix/tags'))
        self.assertFalse(config.is_path_tag_or_branch('tags/something/bla'))
        self.assertFalse(config.is_path_tag_or_branch('prefix/branches/something/bla'))
        self.assertFalse(config.is_path_tag_or_branch('trunk/tags/x'))
        self.assertFalse(config.is_path_tag_or_branch('a/trunk/bla/branches/x'))
Ejemplo n.º 13
0
 def test_custom_trunk(self):
     config = Config(['/repo/path', 'a/b', '--trunk-dir', 'bla', '--tag-or-branch-dir', 'blub'])
     self.assertFalse(config.is_path_tag_or_branch('bla/branches/bar'))
     self.assertFalse(config.is_path_tag_or_branch('blub/branches/bar'))
     self.assertFalse(config.is_path_tag_or_branch('trunk/branches/bar'))
Ejemplo n.º 14
0
 def test_no_extra_mkdirs(self):
     config = Config(['/repo/path', 'a/b', '--no-extra-mkdirs'])
     self.assertEqual(config.create_parent_dirs, False)
Ejemplo n.º 15
0
 def test_l(self):
     config = Config(['/repo/path', 'a/b', '-l', '/some/file'])
     self.assertEqual(config.log_file, '/some/file')
Ejemplo n.º 16
0
    def test_simple_args(self):
        config = Config(['/repo/path', 'a/b/c', 'x/y'])
        self.assertEqual(config.source_repository, '/repo/path')
        self.assertEqual(sorted(config.include_paths), ['a/b/c', 'x/y'])
        self.assertEqual(config.exclude_paths, [])
        self.assertEqual(config.keep_empty_revs, False)
        self.assertEqual(config.start_rev, None)
        self.assertEqual(config.quiet, False)
        self.assertEqual(config.log_file, None)
        self.assertEqual(config.create_parent_dirs, True)
        self.assertEqual(config.drop_old_tags_and_branches, False)

        self.assertTrue(config.is_path_tag_or_branch('tags/something'))
        self.assertTrue(config.is_path_tag_or_branch('prefix/tags/something'))
        self.assertTrue(config.is_path_tag_or_branch('blub/branches/bla'))

        self.assertFalse(config.is_path_tag_or_branch('blub/branches'))
        self.assertFalse(config.is_path_tag_or_branch('trunk'))
        self.assertFalse(config.is_path_tag_or_branch('bla'))
        self.assertFalse(config.is_path_tag_or_branch('tags'))
        self.assertFalse(config.is_path_tag_or_branch('tags/'))
        self.assertFalse(config.is_path_tag_or_branch('tagsX/something'))
        self.assertFalse(config.is_path_tag_or_branch('prefix/tags'))
        self.assertFalse(config.is_path_tag_or_branch('tags/something/bla'))
        self.assertFalse(
            config.is_path_tag_or_branch('prefix/branches/something/bla'))
        self.assertFalse(config.is_path_tag_or_branch('trunk/tags/x'))
        self.assertFalse(
            config.is_path_tag_or_branch('a/trunk/bla/branches/x'))
Ejemplo n.º 17
0
 def test_drop_old_tags_and_branches(self):
     config = Config(['/repo/path', 'a/b', '--drop-old-tags-and-branches'])
     self.assertTrue(config.drop_old_tags_and_branches)
Ejemplo n.º 18
0
 def test_keep_empty_revs(self):
     config = Config(['/repo/path', 'a/b', '--keep-empty-revs'])
     self.assertEqual(config.keep_empty_revs, True)
Ejemplo n.º 19
0
 def test_exclude(self):
     config = Config(['/repo/path', 'a/b/c', '--exclude', 'x/y'])
     self.assertEqual(sorted(config.include_paths), ['a/b/c'])
     self.assertEqual(config.exclude_paths, ['x/y'])