def test_head(self): #branch head hg = self._mk_local_repo() expects = {'author': u'Jan Florian <*****@*****.**>', 'branch': u'closed', 'mess': u'closing', 'node': 'b26fba69aa7b0378bee2a5386f16c14b0f697c18', 'rev': 3, 'short': 'b26fba69aa7b', 'date': dateutil_parse('2012-03-02T15:50:05+0100'), 'files': [], 'tags': [] } self.assertEquals(expects, hg.get_head(branch='closed')) #tip hg = DVCSWrapper(DUMMY_REPO_COPY, vcs='hg') hg.init_repo() new_file = os.path.join(DUMMY_REPO_COPY, TEST_FILE) touch(new_file) hg.commit('always look good. always!') new_file = os.path.join(DUMMY_REPO_COPY, TEST_FILE + '2') touch(new_file) hg.commit('never look bad. never!') tip = hg.get_head() self.assertEquals((u'default', 1), (tip['branch'], tip['rev']))
def test_push_pull(self): hg = self._mk_local_repo() self.assertDictEqual({'files': 0, 'changesets': 0, 'changes': 0}, hg.push()) #copy the cloned repo hg = DVCSWrapper(DUMMY_REPO_COPY, vcs='hg') hg.clone(DUMMY_REPO) #copy again the cloned repo hg_copy = DVCSWrapper(DUMMY_REPO_COPY2, vcs='hg') hg_copy.clone(DUMMY_REPO_COPY) with open(os.path.join(DUMMY_REPO_COPY, TEST_FILE), 'a+') as f: f.write('fap') hg.commit('fap') self.assertDictEqual({'files': 1, 'changesets': 1, 'changes': 1}, hg.push()) self.assertDictEqual({'files': 1, 'changesets': 1, 'changes': 1}, hg_copy.pull()) self.assertEquals({'files': 0, 'changesets': 0, 'changes': 0}, hg_copy.pull(branch='default')) rmrf(DUMMY_REPO_COPY) rmrf(DUMMY_REPO_COPY2)