def test_create_branch(self): clon = hglib.open(os.path.join(self.environment_path, 'repo1')) clon.update('default') hgrepo = Repository(os.path.join(self.environment_path, 'repo1')) hgcs = Changeset(hgrepo, clon.tip()) branch = hgcs.create_branch('fakebranch') self.assertEquals(branch.get_changeset(), hgrepo.tip()) self.assertEquals('fakebranch', clon.branch()) clon.close()
def test_push(self): repo = hglib.open(self.main_repo) repo.update(rev=INITIAL_BRANCH) self.commit_in_repo( self.main_repo, ['f1', 'f2'], ['TICKET-10', 'TICKET-11']) self.commit_in_repo( self.second_repo, ['f3', 'f4'], ['TICKET-12', 'TICKET-13']) repo2 = Repository(self.second_repo) with self.assertRaises(RepositoryError): repo2.push( self.main_repo, self.main_repo, Changeset(None, (1, "inexistent_rev", None, None, None, None))) with self.assertRaises(RepositoryError): repo2.push(self.main_repo, "inexistent_destination") repo2.push(self.main_repo, self.main_repo) logs = [changeset[5] for changeset in repo.log()] self.assertTrue('TICKET-10' in logs) self.assertTrue('TICKET-11' in logs) self.assertTrue('TICKET-12' in logs) self.assertTrue('TICKET-13' in logs) repo.update() self.commit_in_repo( self.main_repo, ['f3', 'f4'], ['TICKET-10', 'TICKET-11']) self.commit_in_repo( self.second_repo, ['f3', 'f4'], ['TICKET-12', 'TICKET-13']) repo.close() # now with conflicts with self.assertRaises(RepositoryError): repo2.push(self.main_repo, self.main_repo, repo2.tip())
def test_push(self): repo = hglib.open(self.main_repo) repo.update(rev=INITIAL_BRANCH) self.commit_in_repo(self.main_repo, ['f1', 'f2'], ['TICKET-10', 'TICKET-11']) self.commit_in_repo(self.second_repo, ['f3', 'f4'], ['TICKET-12', 'TICKET-13']) repo2 = Repository(self.second_repo) with self.assertRaises(RepositoryError): repo2.push( self.main_repo, self.main_repo, Changeset(None, (1, "inexistent_rev", None, None, None, None))) with self.assertRaises(RepositoryError): repo2.push(self.main_repo, "inexistent_destination") repo2.push(self.main_repo, self.main_repo) logs = [changeset[5] for changeset in repo.log()] self.assertTrue('TICKET-10' in logs) self.assertTrue('TICKET-11' in logs) self.assertTrue('TICKET-12' in logs) self.assertTrue('TICKET-13' in logs) repo.update() self.commit_in_repo(self.main_repo, ['f3', 'f4'], ['TICKET-10', 'TICKET-11']) self.commit_in_repo(self.second_repo, ['f3', 'f4'], ['TICKET-12', 'TICKET-13']) repo.close() # now with conflicts with self.assertRaises(RepositoryError): repo2.push(self.main_repo, self.main_repo, repo2.tip())