def test_repo_clone_without_update(self): repo = MercurialRepository(TEST_HG_REPO) repo_clone = MercurialRepository(TEST_HG_REPO_CLONE + '_wo_update', src_url=TEST_HG_REPO, update_after_clone=False) self.assertEqual(len(repo.revisions), len(repo_clone.revisions)) self.assertEqual(os.path.isfile(os.path.join(TEST_HG_REPO_CLONE \ + '_wo_update', 'MANIFEST.in')), False,)
def test_repo_clone_with_update(self): repo = MercurialRepository(TEST_HG_REPO) repo_clone = MercurialRepository(TEST_HG_REPO_CLONE + '_w_update', src_url=TEST_HG_REPO, update_after_clone=True) self.assertEqual(len(repo.revisions), len(repo_clone.revisions)) #check if current workdir was updated self.assertEqual(os.path.isfile(os.path.join(TEST_HG_REPO_CLONE \ + '_w_update', 'MANIFEST.in')), True,)
def test_repo_clone(self): self.__check_for_existing_repo() repo = MercurialRepository(TEST_HG_REPO) repo_clone = MercurialRepository(TEST_HG_REPO_CLONE, src_url=TEST_HG_REPO, update_after_clone=True) self.assertEqual(len(repo.revisions), len(repo_clone.revisions)) # Checking hashes of changesets should be enough for changeset in repo.get_changesets(): raw_id = changeset.raw_id self.assertEqual(raw_id, repo_clone.get_changeset(raw_id).raw_id)
def test_pull(self): if os.path.exists(TEST_HG_REPO_PULL): self.fail('Cannot test mercurial pull command as location %s ' 'already exists. You should manually remove it first' % TEST_HG_REPO_PULL) repo_new = MercurialRepository(TEST_HG_REPO_PULL, create=True) self.assertTrue(len(self.repo.revisions) > len(repo_new.revisions)) repo_new.pull(self.repo.path) repo_new = MercurialRepository(TEST_HG_REPO_PULL) self.assertTrue(len(self.repo.revisions) == len(repo_new.revisions))
def test_unicode_path_repo(self): self.assertRaises(VCSError,lambda:MercurialRepository(u'iShouldFail'))
def setUp(self): self.repo = MercurialRepository(TEST_HG_REPO)