def test_genignore(self):
     """ Test generation of .hgignore file. """
     test_util.load_fixture_and_fetch('ignores.svndump', self.repo_path,
                                      self.wc_path, noupdate=False)
     u = self.ui()
     u.pushbuffer()
     svncommands.genignore(u, self.repo, self.wc_path)
     self.assertEqual(open(os.path.join(self.wc_path, '.hgignore')).read(),
                      '.hgignore\nsyntax:glob\nblah\notherblah\nbaz/magic\n')
 def test_push_new_dir_project_root_not_repo_root(self):
     test_util.load_fixture_and_fetch('fetch_missing_files_subdir.svndump',
                                      self.repo_path,
                                      self.wc_path,
                                      subdir='foo')
     changes = [('magic_new/a', 'magic_new/a', 'ohai', ),
                ]
     self.commitchanges(changes)
     self.pushrevisions()
     self.assertEqual(self.svnls('foo/trunk'), ['bar',
                                                'bar/alpha',
                                                'bar/beta',
                                                'bar/delta',
                                                'bar/gamma',
                                                'foo',
                                                'magic_new',
                                                'magic_new/a'])
Exemple #3
0
    def test_push_externals(self, stupid=False):
        test_util.load_fixture_and_fetch('pushexternals.svndump',
                                         self.repo_path,
                                         self.wc_path)
        # Add a new reference on an existing and non-existing directory
        changes = [
            ('.hgsvnexternals', '.hgsvnexternals',
             """[dir]
 ../externals/project2 deps/project2
[subdir1]
 ../externals/project1 deps/project1
[subdir2]
 ../externals/project2 deps/project2
"""),
            ('subdir1/a', 'subdir1/a', 'a'),
            ('subdir2/a', 'subdir2/a', 'a'),
            ]
        self.commitchanges(changes)
        self.pushrevisions(stupid)
        self.assertchanges(changes, self.repo['tip'])

        # Remove all references from one directory, add a new one
        # to the other (test multiline entries)
        changes = [
            ('.hgsvnexternals', '.hgsvnexternals',
             """[subdir1]
 ../externals/project1 deps/project1
 ../externals/project2 deps/project2
"""),
            # This removal used to trigger the parent directory removal
            ('subdir1/a', None, None),
            ]
        self.commitchanges(changes)
        self.pushrevisions(stupid)
        self.assertchanges(changes, self.repo['tip'])
        # Check subdir2/a is still there even if the externals were removed
        self.assertTrue('subdir2/a' in self.repo['tip'])
        self.assertTrue('subdir1/a' not in self.repo['tip'])

        # Test externals removal
        changes = [
            ('.hgsvnexternals', None, None),
            ]
        self.commitchanges(changes)
        self.pushrevisions(stupid)
        self.assertchanges(changes, self.repo['tip'])
 def test_push_new_file_existing_dir_root_not_repo_root(self):
     test_util.load_fixture_and_fetch('empty_dir_in_trunk_not_repo_root.svndump',
                                      self.repo_path,
                                      self.wc_path,
                                      subdir='project')
     changes = [('narf/a', 'narf/a', 'ohai', ),
                ]
     self.commitchanges(changes)
     self.assertEqual(self.svnls('project/trunk'), ['a',
                                                    'narf',])
     self.pushrevisions()
     self.assertEqual(self.svnls('project/trunk'), ['a',
                                                    'narf',
                                                    'narf/a'])
     changes = [('narf/a', None, None, ),
                ]
     self.commitchanges(changes)
     self.pushrevisions()
     self.assertEqual(self.svnls('project/trunk'), ['a' ,])
 def test_oldest_not_trunk_and_tag_vendor_branch(self):
     repo = test_util.load_fixture_and_fetch(
         'tagged_vendor_and_oldest_not_trunk.svndump',
         self.repo_path,
         self.wc_path,
         True)
     repo = hg.repository(ui.ui(), self.wc_path)
     self.assertEqual(node.hex(repo['oldest'].node()),
                      '926671740dec045077ab20f110c1595f935334fa')
     self.assertEqual(repo['tip'].parents()[0].parents()[0],
                      repo['oldest'])
     self.assertEqual(node.hex(repo['tip'].node()),
                      '1a6c3f30911d57abb67c257ec0df3e7bc44786f7')
 def test_stupid(self):
     repo = test_util.load_fixture_and_fetch('two_heads.svndump',
                                             self.repo_path,
                                             self.wc_path,
                                             True)
     self.assertEqual(node.hex(repo[0].node()),
                      '434ed487136c1b47c1e8f952edb4dc5a8e6328df')
     self.assertEqual(node.hex(repo['tip'].node()),
                      '1083037b18d85cd84fa211c5adbaeff0fea2cd9f')
     self.assertEqual(node.hex(repo['the_branch'].node()),
                      '4e256962fc5df545e2e0a51d0d1dc61c469127e6')
     self.assertEqual(repo['the_branch'].extra()['convert_revision'],
                      'svn:df2126f7-00ab-4d49-b42c-7e981dde0bcf/branches/the_branch@5')
     self.assertEqual(node.hex(repo['the_branch'].parents()[0].node()),
                      'f1ff5b860f5dbb9a59ad0921a79da77f10f25109')
     self.assertEqual(len(repo['tip'].parents()), 1)
     self.assertEqual(repo['default'].extra()['convert_revision'],
                      'svn:df2126f7-00ab-4d49-b42c-7e981dde0bcf/trunk@6')
     self.assertEqual(repo['tip'], repo['default'])
     self.assertEqual(len(repo.heads()), 2)
 def setUp(self):
     test_util.TestBase.setUp(self)
     test_util.load_fixture_and_fetch('simple_branch.svndump',
                                      self.repo_path,
                                      self.wc_path)
Exemple #8
0
 def _load_fixture_and_fetch(self, fixture_name):
     return test_util.load_fixture_and_fetch(fixture_name, self.repo_path,
                                             self.wc_path, stupid=False,
                                             noupdate=False)
 def _load_fixture_and_fetch(self, fixture_name, stupid, noupdate=True,
                             subdir=''):
     return test_util.load_fixture_and_fetch(fixture_name, self.repo_path,
                                             self.wc_path, stupid=stupid,
                                             noupdate=noupdate, subdir=subdir)
 def setUp(self):
     test_util.TestBase.setUp(self)
     test_util.load_fixture_and_fetch('emptyrepo.svndump',
                                      self.repo_path,
                                      self.wc_path)
 def _load_fixture_and_fetch(self, fixture_name, stupid):
     return test_util.load_fixture_and_fetch(fixture_name, self.repo_path, self.wc_path, stupid=stupid)
 def setUp(self):
     test_util.TestBase.setUp(self)
     test_util.load_fixture_and_fetch('pushrenames.svndump',
                                      self.repo_path,
                                      self.wc_path,
                                      True)
Exemple #13
0
    def test_push_hgsub(self, stupid=False):
        if subrepo is None:
            return

        test_util.load_fixture_and_fetch('pushexternals.svndump',
                                         self.repo_path,
                                         self.wc_path,
                                         externals='subrepos')
        # Add a new reference on an existing and non-existing directory
        changes = [
            ('.hgsub', '.hgsub', """\
dir/deps/project2 = [hgsubversion] dir:^/externals/project2 deps/project2
subdir1/deps/project1 = [hgsubversion] subdir1:^/externals/project1 deps/project1
subdir2/deps/project2 = [hgsubversion] subdir2:^/externals/project2 deps/project2
"""),
            ('.hgsubstate', '.hgsubstate', """\
HEAD dir/deps/project2
HEAD subdir1/deps/project1
HEAD subdir2/deps/project2
"""),
            ('subdir1/a', 'subdir1/a', 'a'),
            ('subdir2/a', 'subdir2/a', 'a'),
            ]
        self.svnco('externals/project2', '2', 'dir/deps/project2')
        self.svnco('externals/project1', '2', 'subdir1/deps/project1')
        self.svnco('externals/project2', '2', 'subdir2/deps/project2')
        self.commitchanges(changes)
        self.pushrevisions(stupid)
        self.assertchanges(changes, self.repo['tip'])

        # Check .hgsub and .hgsubstate were not pushed
        self.assertEqual(['dir', 'subdir1', 'subdir1/a', 'subdir2',
                          'subdir2/a'], self.svnls('trunk'))

        # Remove all references from one directory, add a new one
        # to the other (test multiline entries)
        changes = [
            ('.hgsub', '.hgsub', """\
subdir1/deps/project1 = [hgsubversion] subdir1:^/externals/project1 deps/project1
subdir1/deps/project2 = [hgsubversion] subdir1:^/externals/project2 deps/project2
"""),
            ('.hgsubstate', '.hgsubstate', """\
HEAD subdir1/deps/project1
HEAD subdir1/deps/project2
"""),
            # This removal used to trigger the parent directory removal
            ('subdir1/a', None, None),
            ]
        self.svnco('externals/project1', '2', 'subdir1/deps/project1')
        self.svnco('externals/project2', '2', 'subdir1/deps/project2')
        self.commitchanges(changes)
        self.pushrevisions(stupid)
        self.assertchanges(changes, self.repo['tip'])
        # Check subdir2/a is still there even if the externals were removed
        self.assertTrue('subdir2/a' in self.repo['tip'])
        self.assertTrue('subdir1/a' not in self.repo['tip'])

        # Move the externals so they are defined on the base directory,
        # this used to cause full branch removal when deleting the .hgsub
        changes = [
            ('.hgsub', '.hgsub', """\
subdir1/deps/project1 = [hgsubversion] :^/externals/project1 subdir1/deps/project1
"""),
            ('.hgsubstate', '.hgsubstate', """\
HEAD subdir1/deps/project1
"""),
            ]
        self.commitchanges(changes)
        self.pushrevisions(stupid)
        self.assertchanges(changes, self.repo['tip'])

        # Test externals removal
        changes = [
            ('.hgsub', None, None),
            ('.hgsubstate', None, None),
            ]
        self.commitchanges(changes)
        self.pushrevisions(stupid)
        self.assertchanges(changes, self.repo['tip'])
 def setUp(self):
     test_util.TestBase.setUp(self)
     test_util.load_fixture_and_fetch('pushexternals.svndump',
                                      self.repo_path,
                                      self.wc_path)