def test_untracked_files(self): self.repo.index.commit('my root commit') self.commit_detail.options = {'untracked': True} fd, name = mkstemp(dir=self.root) os.close(fd) nodes = self.commit_detail.run() node_p = nodes[0] # <p> node assert_equal(2, len(node_p)) node_w = node_p[1] # nodes.warning node_i = node_w[0] # inline assert_in('untracked', node_i.astext())
def test_more_than_ten_commits(self): for n in range(15): self.repo.index.commit('commit #{0}'.format(n)) nodes = self.changelog.run() assert_equal(1, len(nodes)) list_markup = BeautifulStoneSoup(str(nodes[0])) assert_equal(1, len(list_markup.findAll('bullet_list'))) l = list_markup.bullet_list assert_equal(10, len(l.findAll('list_item'))) for n, child in zip(range(15, 5), l.childGenerator()): assert_in('commit #{0}'.format(n), child.text) assert_not_in('commit #4', l.text)
def test_specifying_number_of_commits(self): for n in range(15): self.repo.index.commit('commit #{0}'.format(n)) self.changelog.options = {'revisions': 5} nodes = self.changelog.run() assert_equal(1, len(nodes)) list_markup = BeautifulStoneSoup(str(nodes[0])) assert_equal(1, len(list_markup.findAll('bullet_list'))) l = list_markup.bullet_list assert_equal(5, len(l.findAll('list_item'))) for n, child in zip(range(15, 10), l.childGenerator()): assert_in('commit #{0}'.format(n), child.text) assert_not_in('commit #9', l.text)
def test_uncommitted_changes(self): fd, name = mkstemp(dir=self.root) self.repo.index.add([name]) self.repo.index.commit('my root commit') os.write(fd, "some change") os.close(fd) self.commit_detail.options = {'uncommitted': True} nodes = self.commit_detail.run() node_p = nodes[0] # <p> node assert_equal(2, len(node_p)) node_w = node_p[1] # nodes.warning node_i = node_w[0] # inline assert_in('uncommitted', node_i.astext())
def test_specifying_a_rev_list(self): self.repo.index.commit('before tag') commit = self.repo.index.commit('at tag') self.repo.index.commit('after tag') self.repo.index.commit('last commit') self.repo.create_tag('testtag', commit) self.changelog.options = {'rev-list': 'testtag..'} nodes = self.changelog.run() assert_equal(1, len(nodes)) list_markup = BeautifulStoneSoup(str(nodes[0])) assert_equal(1, len(list_markup.findAll('bullet_list'))) l = list_markup.bullet_list assert_equal(2, len(l.findAll('list_item'))) children = list(l.childGenerator()) first_element = children[0] second_element = children[1] assert_in('last commit', first_element.text) assert_in('after tag', second_element.text)