Ejemplo n.º 1
0
    def test_push_branch(self):
        def determine_wants(*args):
            return {
                "refs/heads/mybranch": local_repo.refs["refs/heads/mybranch"]
            }

        local_repo = repo.Repo.init(self.temp_d, mkdir=True)
        # Nothing in the staging area
        local_repo.do_commit('Test commit',
                             'fbo@localhost',
                             ref='refs/heads/mybranch')
        sha = local_repo.refs.read_loose_ref('refs/heads/mybranch')
        swift.SwiftRepo.init_bare(self.scon, self.conf)
        tcp_client = client.TCPGitClient(self.server_address, port=self.port)
        tcp_client.send_pack("/fakerepo", determine_wants,
                             local_repo.object_store.generate_pack_contents)
        swift_repo = swift.SwiftRepo(self.fakerepo, self.conf)
        remote_sha = swift_repo.refs.read_loose_ref('refs/heads/mybranch')
        self.assertEqual(sha, remote_sha)
Ejemplo n.º 2
0
 def open_repository(self, path):
     return swift.SwiftRepo(path, conf=swift.load_conf())
Ejemplo n.º 3
0
 def test_init(self):
     store = {'fakerepo/objects/pack': ''}
     with patch('dulwich.contrib.swift.SwiftConnector',
                new_callable=create_swift_connector,
                store=store):
         swift.SwiftRepo('fakerepo', conf=self.conf)