示例#1
0
    def test_push_to_dulwich_no_op(self):
        self._old_repo = import_repo('server_old.export')
        self._new_repo = import_repo('server_old.export')
        self.assertReposEqual(self._old_repo, self._new_repo)
        port = self._start_server(self._old_repo)

        run_git_or_fail(['push', self.url(port)] + self.branch_args(),
                        cwd=self._new_repo.path)
        self.assertReposEqual(self._old_repo, self._new_repo)
示例#2
0
    def test_push_to_dulwich_no_op(self):
        self._old_repo = import_repo('server_old.export')
        self._new_repo = import_repo('server_old.export')
        self.assertReposEqual(self._old_repo, self._new_repo)
        port = self._start_server(self._old_repo)

        run_git_or_fail(['push', self.url(port)] + self.branch_args(),
                        cwd=self._new_repo.path)
        self.assertReposEqual(self._old_repo, self._new_repo)
示例#3
0
    def test_push_to_dulwich_no_op(self):
        self._old_repo = import_repo("server_old.export")
        self.addCleanup(tear_down_repo, self._old_repo)
        self._new_repo = import_repo("server_old.export")
        self.addCleanup(tear_down_repo, self._new_repo)
        self.assertReposEqual(self._old_repo, self._new_repo)
        port = self._start_server(self._old_repo)

        run_git_or_fail(["push", self.url(port)] + self.branch_args(), cwd=self._new_repo.path)
        self.assertReposEqual(self._old_repo, self._new_repo)
示例#4
0
    def test_push_to_dulwich_remove_branch(self):
        self._old_repo = import_repo('server_old.export')
        self._new_repo = import_repo('server_old.export')
        self.assertReposEqual(self._old_repo, self._new_repo)
        port = self._start_server(self._old_repo)

        run_git_or_fail(['push', self.url(port), ":master"],
                        cwd=self._new_repo.path)

        self.assertEquals(
            self._old_repo.get_refs().keys(), ["refs/heads/branch"])
示例#5
0
    def test_fetch_from_dulwich_no_op(self):
        self._old_repo = import_repo('server_old.export')
        self._new_repo = import_repo('server_old.export')
        self.assertReposEqual(self._old_repo, self._new_repo)
        port = self._start_server(self._new_repo)

        run_git_or_fail(['fetch', self.url(port)] + self.branch_args(),
                        cwd=self._old_repo.path)
        # flush the pack cache so any new packs are picked up
        self._old_repo.object_store._pack_cache = None
        self.assertReposEqual(self._old_repo, self._new_repo)
示例#6
0
    def test_push_to_dulwich_remove_branch(self):
        self._old_repo = import_repo('server_old.export')
        self._new_repo = import_repo('server_old.export')
        self.assertReposEqual(self._old_repo, self._new_repo)
        port = self._start_server(self._old_repo)

        run_git_or_fail(['push', self.url(port), ":master"],
                        cwd=self._new_repo.path)

        self.assertEquals(self._old_repo.get_refs().keys(),
                          ["refs/heads/branch"])
示例#7
0
    def test_fetch_from_dulwich_no_op(self):
        self._old_repo = import_repo('server_old.export')
        self._new_repo = import_repo('server_old.export')
        self.assertReposEqual(self._old_repo, self._new_repo)
        port = self._start_server(self._new_repo)

        run_git_or_fail(['fetch', self.url(port)] + self.branch_args(),
                        cwd=self._old_repo.path)
        # flush the pack cache so any new packs are picked up
        self._old_repo.object_store._pack_cache = None
        self.assertReposEqual(self._old_repo, self._new_repo)
示例#8
0
    def test_fetch_same_depth_into_shallow_clone_from_dulwich(self):
        require_git_version(self.min_single_branch_version)
        self._source_repo = import_repo('server_new.export')
        self.addCleanup(tear_down_repo, self._source_repo)
        self._stub_repo = _StubRepo('shallow')
        self.addCleanup(tear_down_repo, self._stub_repo)
        port = self._start_server(self._source_repo)

        # Fetch at depth 1
        run_git_or_fail([
            'clone', '--mirror', '--depth=1', '--no-single-branch',
            self.url(port), self._stub_repo.path
        ])
        clone = self._stub_repo = Repo(self._stub_repo.path)

        # Fetching at the same depth is a no-op.
        run_git_or_fail(
            ['fetch', '--depth=1', self.url(port)] + self.branch_args(),
            cwd=self._stub_repo.path)
        expected_shallow = [
            '94de09a530df27ac3bb613aaecdd539e0a0655e1',
            'da5cd81e1883c62a25bb37c4d1f8ad965b29bf8d'
        ]
        self.assertEqual(expected_shallow, _get_shallow(clone))
        self.assertReposNotEqual(clone, self._source_repo)
示例#9
0
    def test_fetch_full_depth_into_shallow_clone_from_dulwich(self):
        self._source_repo = import_repo('server_new.export')
        self.addCleanup(tear_down_repo, self._source_repo)
        self._stub_repo = _StubRepo('shallow')
        self.addCleanup(tear_down_repo, self._stub_repo)
        port = self._start_server(self._source_repo)

        # Fetch at depth 1
        run_git_or_fail([
            'clone', '--mirror', '--depth=1', '--no-single-branch',
            self.url(port), self._stub_repo.path
        ])
        clone = self._stub_repo = Repo(self._stub_repo.path)

        # Fetching at the same depth is a no-op.
        run_git_or_fail(
            ['fetch', '--depth=1', self.url(port)] + self.branch_args(),
            cwd=self._stub_repo.path)

        # The whole repo only has depth 3, so it should equal server_new.
        run_git_or_fail(
            ['fetch', '--depth=3', self.url(port)] + self.branch_args(),
            cwd=self._stub_repo.path)
        self.assertEqual([], _get_shallow(clone))
        self.assertReposEqual(clone, self._source_repo)
示例#10
0
    def test_new_shallow_clone_from_dulwich(self):
        self._source_repo = import_repo("server_new.export")
        self.addCleanup(tear_down_repo, self._source_repo)
        self._stub_repo = _StubRepo("shallow")
        self.addCleanup(tear_down_repo, self._stub_repo)
        port = self._start_server(self._source_repo)

        # Fetch at depth 1
        run_git_or_fail(["clone", "--mirror", "--depth=1", "--no-single-branch", self.url(port), self._stub_repo.path])
        clone = self._stub_repo = Repo(self._stub_repo.path)
        expected_shallow = ["94de09a530df27ac3bb613aaecdd539e0a0655e1", "da5cd81e1883c62a25bb37c4d1f8ad965b29bf8d"]
        self.assertEqual(expected_shallow, _get_shallow(clone))
        self.assertReposNotEqual(clone, self._source_repo)
示例#11
0
    def test_new_shallow_clone_from_dulwich(self):
        self._source_repo = import_repo('server_new.export')
        self.addCleanup(tear_down_repo, self._source_repo)
        self._stub_repo = _StubRepo('shallow')
        self.addCleanup(tear_down_repo, self._stub_repo)
        port = self._start_server(self._source_repo)

        # Fetch at depth 1
        run_git_or_fail(['clone', '--mirror', '--depth=1', '--no-single-branch',
                        self.url(port), self._stub_repo.path])
        clone = self._stub_repo = Repo(self._stub_repo.path)
        expected_shallow = ['94de09a530df27ac3bb613aaecdd539e0a0655e1',
                            'da5cd81e1883c62a25bb37c4d1f8ad965b29bf8d']
        self.assertEqual(expected_shallow, _get_shallow(clone))
        self.assertReposNotEqual(clone, self._source_repo)
示例#12
0
    def test_new_shallow_clone_from_dulwich(self):
        require_git_version(self.min_single_branch_version)
        self._source_repo = import_repo('server_new.export')
        self.addCleanup(tear_down_repo, self._source_repo)
        self._stub_repo = _StubRepo('shallow')
        self.addCleanup(tear_down_repo, self._stub_repo)
        port = self._start_server(self._source_repo)

        # Fetch at depth 1
        run_git_or_fail(['clone', '--mirror', '--depth=1', '--no-single-branch',
                        self.url(port), self._stub_repo.path])
        clone = self._stub_repo = Repo(self._stub_repo.path)
        expected_shallow = ['94de09a530df27ac3bb613aaecdd539e0a0655e1',
                            'da5cd81e1883c62a25bb37c4d1f8ad965b29bf8d']
        self.assertEqual(expected_shallow, _get_shallow(clone))
        self.assertReposNotEqual(clone, self._source_repo)
示例#13
0
    def test_fetch_full_depth_into_shallow_clone_from_dulwich(self):
        self._source_repo = import_repo("server_new.export")
        self.addCleanup(tear_down_repo, self._source_repo)
        self._stub_repo = _StubRepo("shallow")
        self.addCleanup(tear_down_repo, self._stub_repo)
        port = self._start_server(self._source_repo)

        # Fetch at depth 1
        run_git_or_fail(["clone", "--mirror", "--depth=1", "--no-single-branch", self.url(port), self._stub_repo.path])
        clone = self._stub_repo = Repo(self._stub_repo.path)

        # Fetching at the same depth is a no-op.
        run_git_or_fail(["fetch", "--depth=1", self.url(port)] + self.branch_args(), cwd=self._stub_repo.path)

        # The whole repo only has depth 3, so it should equal server_new.
        run_git_or_fail(["fetch", "--depth=3", self.url(port)] + self.branch_args(), cwd=self._stub_repo.path)
        self.assertEqual([], _get_shallow(clone))
        self.assertReposEqual(clone, self._source_repo)
示例#14
0
    def test_fetch_same_depth_into_shallow_clone_from_dulwich(self):
        self._source_repo = import_repo('server_new.export')
        self.addCleanup(tear_down_repo, self._source_repo)
        self._stub_repo = _StubRepo('shallow')
        self.addCleanup(tear_down_repo, self._stub_repo)
        port = self._start_server(self._source_repo)

        # Fetch at depth 1
        run_git_or_fail(['clone', '--mirror', '--depth=1', '--no-single-branch',
                        self.url(port), self._stub_repo.path])
        clone = self._stub_repo = Repo(self._stub_repo.path)

        # Fetching at the same depth is a no-op.
        run_git_or_fail(
          ['fetch', '--depth=1', self.url(port)] + self.branch_args(),
          cwd=self._stub_repo.path)
        expected_shallow = ['94de09a530df27ac3bb613aaecdd539e0a0655e1',
                            'da5cd81e1883c62a25bb37c4d1f8ad965b29bf8d']
        self.assertEqual(expected_shallow, _get_shallow(clone))
        self.assertReposNotEqual(clone, self._source_repo)
示例#15
0
    def test_fetch_full_depth_into_shallow_clone_from_dulwich(self):
        require_git_version(self.min_single_branch_version)
        self._source_repo = import_repo('server_new.export')
        self.addCleanup(tear_down_repo, self._source_repo)
        self._stub_repo = _StubRepo('shallow')
        self.addCleanup(tear_down_repo, self._stub_repo)
        port = self._start_server(self._source_repo)

        # Fetch at depth 1
        run_git_or_fail(['clone', '--mirror', '--depth=1', '--no-single-branch',
                        self.url(port), self._stub_repo.path])
        clone = self._stub_repo = Repo(self._stub_repo.path)

        # Fetching at the same depth is a no-op.
        run_git_or_fail(
          ['fetch', '--depth=1', self.url(port)] + self.branch_args(),
          cwd=self._stub_repo.path)

        # The whole repo only has depth 3, so it should equal server_new.
        run_git_or_fail(
          ['fetch', '--depth=3', self.url(port)] + self.branch_args(),
          cwd=self._stub_repo.path)
        self.assertEqual([], _get_shallow(clone))
        self.assertReposEqual(clone, self._source_repo)
示例#16
0
 def test_lsremote_from_dulwich(self):
     self._repo = import_repo('server_old.export')
     port = self._start_server(self._repo)
     o = run_git_or_fail(['ls-remote', self.url(port)])
     self.assertEqual(len(o.split('\n')), 4)
示例#17
0
 def test_lsremote_from_dulwich(self):
     self._repo = import_repo("server_old.export")
     port = self._start_server(self._repo)
     o = run_git_or_fail(["ls-remote", self.url(port)])
     self.assertEqual(len(o.split("\n")), 4)
示例#18
0
 def import_repos(self):
     self._old_repo = import_repo('server_old.export')
     self.addCleanup(tear_down_repo, self._old_repo)
     self._new_repo = import_repo('server_new.export')
     self.addCleanup(tear_down_repo, self._new_repo)
示例#19
0
 def setUp(self):
     CompatTestCase.setUp(self)
     self._repo = import_repo('server_new.export')
示例#20
0
 def setUp(self):
     super(ObjectStoreTestCase, self).setUp()
     self._repo = import_repo('server_new.export')
     self.addCleanup(tear_down_repo, self._repo)
示例#21
0
 def import_repos(self):
     self._old_repo = import_repo('server_old.export')
     self._new_repo = import_repo('server_new.export')
示例#22
0
 def import_repos(self):
     self._old_repo = import_repo('server_old.export')
     self.addCleanup(tear_down_repo, self._old_repo)
     self._new_repo = import_repo('server_new.export')
     self.addCleanup(tear_down_repo, self._new_repo)
示例#23
0
 def setUp(self):
     super(ObjectStoreTestCase, self).setUp()
     self._repo = import_repo('server_new.export')
     self.addCleanup(tear_down_repo, self._repo)
示例#24
0
 def test_lsremote_from_dulwich(self):
     self._repo = import_repo('server_old.export')
     port = self._start_server(self._repo)
     o = run_git_or_fail(['ls-remote', self.url(port)])
     self.assertEqual(len(o.split('\n')), 4)