def test_warning_given_if_rev_list_and_revisions_both_given(self):
     self.repo.index.commit('a commit')
     self.changelog.options = {'rev-list': 'HEAD', 'revisions': 12}
     nodes = self.changelog.run()
     assert_equal(
         1, self.changelog.state.document.reporter.warning.call_count
     )
예제 #2
0
 def test_line_number_displayed_in_multiple_option_warning(self):
     self.repo.index.commit('a commit')
     self.changelog.options = {'rev-list': 'HEAD', 'revisions': 12}
     nodes = self.changelog.run()
     document_reporter = self.changelog.state.document.reporter
     assert_equal([call(ANY, line=self.changelog.lineno)],
                  document_reporter.warning.call_args_list)
예제 #3
0
 def test_line_number_displayed_in_multiple_option_warning(self):
     self.changelog.options = {'rev-list': 'foo..', 'revisions': 12}
     nodes = self.changelog.run()
     document_reporter = self.changelog.state.document.reporter
     assert_equal(
         [call(ANY, line=self.changelog.lineno)],
         document_reporter.warning.call_args_list
     )
 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_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_github_link(self):
     self.repo.index.commit('my root commit')
     self.commit_detail.options = {'commit': True}
     self.repo.create_remote('origin', self.commit_detail.github_nonce_url)
     nodes = self.commit_detail.run()
     list_markup = BeautifulStoneSoup(str(nodes[0]))
     assert_is_not(list_markup.reference, None)
     assert_equal(
         self.commit_detail.github_nonce_commit_base +
         self.repo.commit().hexsha, list_markup.reference['refuri'])
     assert_equal(
         self.repo.commit().hexsha[:GitCommitDetail.default_sha_length],
         list_markup.reference.text)
예제 #7
0
 def test_single_commit_preformmated_detail_lines(self):
     self.repo.index.commit(
         'my root commit\n\nadditional information\nmore info')
     self.changelog.options = {'detailed-message-pre': True}
     nodes = self.changelog.run()
     list_markup = BeautifulStoneSoup(str(nodes[0]))
     item = list_markup.bullet_list.list_item
     children = list(item.childGenerator())
     assert_equal(6, len(children))
     assert_equal(
         str(children[5]),
         '<literal_block xml:space="preserve">additional information\n'
         'more info</literal_block>')
 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_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_single_commit_preformmated_detail_lines(self):
     self.repo.index.commit(
         'my root commit\n\nadditional information\nmore info'
     )
     self.changelog.options = {'detailed-message-pre': True}
     nodes = self.changelog.run()
     list_markup = BeautifulStoneSoup(str(nodes[0]))
     item = list_markup.bullet_list.list_item
     children = list(item.childGenerator())
     assert_equal(6, len(children))
     assert_equal(
         str(children[5]),
         '<literal_block xml:space="preserve">additional information\n'
         'more info</literal_block>'
     )
 def test_github_link(self):
     self.repo.index.commit('my root commit')
     self.commit_detail.options = {'commit': True}
     self.repo.create_remote('origin', self.commit_detail.github_nonce_url)
     nodes = self.commit_detail.run()
     list_markup = BeautifulStoneSoup(str(nodes[0]))
     assert_is_not(list_markup.reference, None)
     assert_equal(
         self.commit_detail.github_nonce_commit_base +
         self.repo.commit().hexsha,
         list_markup.reference['refuri']
     )
     assert_equal(
         self.repo.commit().hexsha[:GitCommitDetail.default_sha_length],
         list_markup.reference.text
     )
예제 #12
0
 def test_single_commit_multiple_lines(self):
     self.repo.index.commit("my root commit\n\nadditional information")
     nodes = self.changelog.run()
     list_markup = BeautifulStoneSoup(str(nodes[0]))
     item = list_markup.bullet_list.list_item
     children = list(item.childGenerator())
     assert_equal(6, len(children))
     assert_equal("my root commit", children[0].text)
     assert_equal("Test User", children[2].text)
     assert_equal(str(children[5]), "<caption>additional information</caption>")
예제 #13
0
 def test_single_commit_multiple_lines(self):
     self.repo.index.commit('my root commit\n\nadditional information')
     nodes = self.changelog.run()
     list_markup = BeautifulStoneSoup(str(nodes[0]))
     item = list_markup.bullet_list.list_item
     children = list(item.childGenerator())
     assert_equal(6, len(children))
     assert_equal('my root commit', children[0].text)
     assert_equal('Test User', children[2].text)
     assert_equal(str(children[5]),
                  '<caption>additional information</caption>')
예제 #14
0
 def test_single_commit_default_detail_setting(self):
     self.repo.index.commit(
         'my root commit\n\nadditional information\nmore info')
     nodes = self.changelog.run()
     list_markup = BeautifulStoneSoup(str(nodes[0]))
     item = list_markup.bullet_list.list_item
     children = list(item.childGenerator())
     assert_equal(6, len(children))
     assert_equal('my root commit', children[0].text)
     assert_equal('Test User', children[2].text)
     assert_equal(
         str(children[5]),
         '<paragraph>additional information\nmore info</paragraph>')
 def test_single_commit_default_detail_setting(self):
     self.repo.index.commit(
         'my root commit\n\nadditional information\nmore info'
     )
     nodes = self.changelog.run()
     list_markup = BeautifulStoneSoup(str(nodes[0]))
     item = list_markup.bullet_list.list_item
     children = list(item.childGenerator())
     assert_equal(6, len(children))
     assert_equal('my root commit', children[0].text)
     assert_equal('Test User', children[2].text)
     assert_equal(
         str(children[5]),
         '<paragraph>additional information\nmore info</paragraph>'
     )
예제 #16
0
 def test_single_commit_produces_single_item(self):
     self.repo.index.commit('my root commit')
     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(1, len(l.findAll('list_item')))
 def test_single_commit_produces_single_item(self):
     self.repo.index.commit('my root commit')
     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(1, len(l.findAll('list_item')))
예제 #18
0
 def test_single_commit_message_and_user_display(self):
     self.repo.index.commit('my root commit')
     nodes = self.changelog.run()
     list_markup = BeautifulStoneSoup(str(nodes[0]))
     item = list_markup.bullet_list.list_item
     children = list(item.childGenerator())
     assert_equal(5, len(children))
     assert_equal('my root commit', children[0].text)
     assert_equal('Test User', children[2].text)
 def test_single_commit_message_and_user_display(self):
     self.repo.index.commit('my root commit')
     nodes = self.changelog.run()
     list_markup = BeautifulStoneSoup(str(nodes[0]))
     item = list_markup.bullet_list.list_item
     children = list(item.childGenerator())
     assert_equal(5, len(children))
     assert_equal('my root commit', children[0].text)
     assert_equal('Test User', children[2].text)
 def test_branch_only(self):
     self.repo.index.commit('my root commit')
     self.commit_detail.options = {'branch': True}
     nodes = self.commit_detail.run()
     node_p = nodes[0]       # <p> node
     node_fl = node_p[0]     # field list
     node_f = node_fl[0]     # field
     assert_equal(1, len(node_fl))
     assert_equal('Branch', node_f[0].astext())
     assert_equal('master', node_f[1].astext())
 def test_sha_length(self):
     self.repo.index.commit('my root commit')
     self.commit_detail.options = {'commit': True, 'sha_length': 4}
     nodes = self.commit_detail.run()
     node_p = nodes[0]       # <p> node
     node_fl = node_p[0]     # field list
     node_f = node_fl[0]     # field
     assert_equal(1, len(node_fl))
     assert_equal('Commit', node_f[0].astext())
     assert_equal(self.repo.commit().hexsha[:4], node_f[1].astext())
 def test_single_commit_message_and_user_display_with_non_ascii_chars(self):
     self.repo.config_writer().set_value('user', 'name', 'þéßþ  Úßéë')
     self.repo.index.commit('my root commit')
     nodes = self.changelog.run()
     list_markup = BeautifulStoneSoup(str(nodes[0]))
     item = list_markup.bullet_list.list_item
     children = list(item.childGenerator())
     assert_equal(5, len(children))
     assert_equal('my root commit', children[0].text)
     assert_equal(u'þéßþ  Úßéë', children[2].text)
 def test_sha_length(self):
     self.repo.index.commit('my root commit')
     self.commit_detail.options = {'commit': True, 'sha_length': 4}
     nodes = self.commit_detail.run()
     node_p = nodes[0]  # <p> node
     node_fl = node_p[0]  # field list
     node_f = node_fl[0]  # field
     assert_equal(1, len(node_fl))
     assert_equal('Commit', node_f[0].astext())
     assert_equal(self.repo.commit().hexsha[:4], node_f[1].astext())
예제 #24
0
 def test_single_commit_message_and_user_display_with_non_ascii_chars(self):
     self.repo.config_writer().set_value('user', 'name', 'þéßþ  Úßéë')
     self.repo.index.commit('my root commit')
     nodes = self.changelog.run()
     list_markup = BeautifulStoneSoup(str(nodes[0]))
     item = list_markup.bullet_list.list_item
     children = list(item.childGenerator())
     assert_equal(5, len(children))
     assert_equal('my root commit', children[0].text)
     assert_equal(u'þéßþ  Úßéë', children[2].text)
 def test_branch_only(self):
     self.repo.index.commit('my root commit')
     self.commit_detail.options = {'branch': True}
     nodes = self.commit_detail.run()
     node_p = nodes[0]  # <p> node
     node_fl = node_p[0]  # field list
     node_f = node_fl[0]  # field
     assert_equal(1, len(node_fl))
     assert_equal('Branch', node_f[0].astext())
     assert_equal('master', node_f[1].astext())
 def test_commit_and_branch(self):
     self.repo.index.commit('my root commit')
     self.commit_detail.options = {'commit': True, 'branch': True}
     nodes = self.commit_detail.run()
     node_p = nodes[0]  # <p> node
     node_fl = node_p[0]  # field list
     node_f_b = node_fl[0]  # field--branch
     node_f_c = node_fl[1]  # field--commit
     assert_equal(2, len(node_fl))
     assert_equal('Commit', node_f_c[0].astext())
     assert_equal('Branch', node_f_b[0].astext())
 def test_commit_and_branch(self):
     self.repo.index.commit('my root commit')
     self.commit_detail.options = {'commit': True, 'branch': True}
     nodes = self.commit_detail.run()
     node_p = nodes[0]       # <p> node
     node_fl = node_p[0]     # field list
     node_f_b = node_fl[0]     # field--branch
     node_f_c = node_fl[1]     # field--commit
     assert_equal(2, len(node_fl))
     assert_equal('Commit', node_f_c[0].astext())
     assert_equal('Branch', node_f_b[0].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)
예제 #29
0
 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)
예제 #31
0
 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_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)
예제 #33
0
    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)
예제 #34
0
 def test_warning_given_if_rev_list_and_revisions_both_given(self):
     self.repo.index.commit('a commit')
     self.changelog.options = {'rev-list': 'HEAD', 'revisions': 12}
     nodes = self.changelog.run()
     assert_equal(1,
                  self.changelog.state.document.reporter.warning.call_count)