def test_01_from_snapshot_banner(self):
     """
     Guess the commit to start from from the snapshot banner
     """
     cp = testutils.MockedChangeLog(self.version,
                          "*** SNAPSHOT build @12345 ***")
     guessed_commit = dch.guess_documented_commit(cp, None, None)
     self.assertEqual(guessed_commit, '12345')
    def test_04_not_touched(self):
        """
        None of the above matched so we want to start from
        the beginning of history
        """
        cp = testutils.MockedChangeLog(self.version)

        self.add_file('doesnot', 'matter')
        self.add_file('doesnot', 'mattereither')
        guessed_commit = dch.guess_documented_commit(cp,
                                                     self.repo,
                                                     self.tagformat)
        self.assertIsNone(guessed_commit)
示例#3
0
    def test_guess_no_epoch(self):
        """Guess the new version from the upstream tag"""
        cp = testutils.MockedChangeLog('1.0-1')
        tagformat = 'upstream/%(version)s'
        uversion = '1.1'

        self.add_file('doesnot', 'matter')
        tag = self.repo.version_to_tag(tagformat, uversion)
        self.repo.create_tag(name=tag,
                             msg="Upstream release %s" % uversion,
                             sign=False)

        guessed = dch.guess_version_from_upstream(self.repo, tagformat, cp)
        self.assertEqual('1.1-1', guessed)
    def test_03_from_changelog_commit(self):
        """
        Guess the commit to start from from the commit that
        last touched the changelog
        """
        cp = testutils.MockedChangeLog(self.version)

        self.add_file('debian/changelog', 'foo')
        commit = self.repo.head
        self.add_file('doesnot', 'matter')
        guessed_commit = dch.guess_documented_commit(cp,
                                                     self.repo,
                                                     self.tagformat)
        self.assertEqual(guessed_commit, commit)
示例#5
0
    def test_guess_epoch(self):
        """Check if we picked up the epoch correctly (#652366)"""
        cp = testutils.MockedChangeLog('1:1.0-1')

        tagformat = 'upstream/%(version)s'
        uversion = '1.1'

        self.add_file('doesnot', 'matter')
        tag = self.repo.version_to_tag(tagformat, uversion)
        self.repo.create_tag(name=tag,
                             msg="Upstream release %s" % uversion,
                             sign=False)

        guessed = dch.guess_version_from_upstream(self.repo, tagformat, cp)

        self.assertEqual('1:1.1-1', guessed)
    def test_02_from_tag(self):
        """
        Guess the commit to start from from the tag matching
        the topmost version in the changelog
        """
        cp = testutils.MockedChangeLog(self.version)

        self.add_file('doesnot', 'matter')
        tag = self.repo.version_to_tag(self.tagformat,
                                       self.version)
        self.repo.create_tag(name=tag,
                             msg="Debian release %s" % self.version,
                             sign=False)
        commit = self.repo.rev_parse('%s^0' % tag)
        guessed_commit = dch.guess_documented_commit(cp,
                                                     self.repo,
                                                     self.tagformat)
        self.assertEqual(guessed_commit, commit)