def test_push_to_dulwich(self): self.assertReposNotEqual(self._old_repo, self._new_repo) port = self._start_server(self._old_repo) all_branches = ['master', 'branch'] branch_args = ['%s:%s' % (b, b) for b in all_branches] url = '%s://localhost:%s/' % (self.protocol, port) returncode, _ = run_git(['push', url] + branch_args, cwd=self._new_repo.path) self.assertEqual(0, returncode) self.assertReposEqual(self._old_repo, self._new_repo)
def test_fetch_from_dulwich(self): self.assertReposNotEqual(self._old_repo, self._new_repo) port = self._start_server(self._new_repo) all_branches = ['master', 'branch'] branch_args = ['%s:%s' % (b, b) for b in all_branches] url = '%s://localhost:%s/' % (self.protocol, port) returncode, _ = run_git(['fetch', url] + 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.assertEqual(0, returncode) self.assertReposEqual(self._old_repo, self._new_repo)
def test_copy(self): origpack = self.get_pack(pack1_sha) self.assertEquals(True, origpack.index.check()) pack_path = os.path.join(self._tempdir, "Elch") write_pack(pack_path, [(x, "") for x in origpack.iterobjects()], len(origpack)) returncode, output = run_git(['verify-pack', '-v', pack_path], capture_stdout=True) self.assertEquals(0, returncode) pack_shas = set() for line in output.splitlines(): sha = line[:40] try: binascii.unhexlify(sha) except TypeError: continue # non-sha line pack_shas.add(sha) orig_shas = set(o.id for o in origpack.iterobjects()) self.assertEquals(orig_shas, pack_shas)
def run(self, cmd): return run_git(cmd)
def run(self, cmd): return run_git(self.repo_path, cmd)