コード例 #1
0
    def test_debian_commands(self):
        """Test default BTS command extraction that is applicable to Debian"""
        options = OptionsStub()
        lines = """This is a test commit

Closes: bug#12345
Closes: 456
"""
        bugs, dummy = extract_bts_cmds(lines.split("\n"), options)
        self.assertEquals(bugs, {"Closes": ["bug#12345", "456"]})
コード例 #2
0
    def test_debian_commands(self):
        """Test default BTS command extraction that is applicable to Debian"""
        options = OptionsStub()
        lines = """This is a test commit

Closes: bug#12345
Closes: 456
"""
        bugs, dummy = extract_bts_cmds(lines.split('\n'), options)
        self.assertEquals(bugs, {'Closes': ['bug#12345', '456']})
コード例 #3
0
    def test_nondebian_commands(self):
        """Test non-default BTS commands. We use the example given in the
        documentation manpages."""
        options = OptionsStub()
        options.meta_closes_bugnum = "(?:bug)?\s*ex-\d+"
        lines = """This is a test commit
some more lines...

Closes: bug EX-12345
Closes: ex-01273
Closes: bug ex-1ab
Closes: EX--12345
"""
        bugs, dummy = extract_bts_cmds(lines.split("\n"), options)
        self.assertEquals(bugs, {"Closes": ["bug EX-12345", "ex-01273", "bug ex-1"]})
コード例 #4
0
    def test_nondebian_commands(self):
        """Test non-default BTS commands. We use the example given in the
        documentation manpages."""
        options = OptionsStub()
        options.meta_closes_bugnum = r'(?:bug)?\s*ex-\d+'
        lines = """This is a test commit
some more lines...

Closes: bug EX-12345
Closes: ex-01273
Closes: bug ex-1ab
Closes: EX--12345
"""
        bugs, dummy = extract_bts_cmds(lines.split('\n'), options)
        self.assertEquals(bugs,
                          {'Closes': ['bug EX-12345', 'ex-01273', 'bug ex-1']})
コード例 #5
0
ファイル: pq.py プロジェクト: marquiz/git-buildpackage-rpm
def format_series_diff(added, removed, options):
    """
    Format the patch differences into a suitable commit message

    >>> format_series_diff(['a'], ['b'], None)
    'Rediff patches\\n\\nAdd a: <REASON>\\nDrop b: <REASON>\\n'
    """
    if len(added) == 1 and not removed:
        # Single patch added, create a more thorough commit message
        patch = Patch(os.path.join('debian', 'patches', added[0]))
        msg = patch.subject
        bugs, dummy = extract_bts_cmds(patch.long_desc.split('\n'), options)
        if bugs:
            msg += '\n'
            for k, v in bugs.items():
                msg += '\n%s: %s' % (k, ', '.join(v))
    else:
        msg = "Rediff patches\n\n"
        for p in added:
            msg += 'Add %s: <REASON>\n' % p
        for p in removed:
            msg += 'Drop %s: <REASON>\n' % p
    return msg
コード例 #6
0
ファイル: pq.py プロジェクト: cxy-uestc/git-buildpackage-rpm
def format_series_diff(added, removed, options):
    """
    Format the patch differences into a suitable commit message

    >>> format_series_diff(['a'], ['b'], None)
    'Rediff patches\\n\\nAdded a: <REASON>\\nDropped b: <REASON>\\n'
    """
    if len(added) == 1 and not removed:
        # Single patch added, create a more thorough commit message
        patch = Patch(os.path.join('debian', 'patches', added[0]))
        msg = patch.subject
        bugs, dummy = extract_bts_cmds(patch.long_desc.split('\n'), options)
        if bugs:
            msg += '\n'
            for k, v in bugs.items():
                msg += '\n%s: %s' % (k, ', '.join(v))
    else:
        msg = "Rediff patches\n\n"
        for p in added:
            msg += 'Added %s: <REASON>\n' % p
        for p in removed:
            msg += 'Dropped %s: <REASON>\n' % p
    return msg