예제 #1
0
 def test_flyspray(self):
     self.assertEqual(
         '1234',
         get_bug_id(
             'https://flyspray.example.com/index.php?do=details&task_id=1234'
         ))
     self.assertEqual('1234',
                      get_bug_id('https://bugs.flyspray.org/task/1234'))
예제 #2
0
    def data(self, index, role):

        if not index.isValid():
            return None

        def blank():
            if role == QtCore.Qt.DisplayRole:
                return ""
            return None

        c_rev = self.computed.filtered_revs[index.row()]
        if c_rev is None:
            return blank()

        if c_rev.rev.revid in cached_revisions:
            revision = cached_revisions[c_rev.rev.revid]
        else:
            revision = None

        if role == GraphDataRole:
            prev_c_rev = None
            prev_c_rev_f_index = c_rev.f_index - 1
            if prev_c_rev_f_index >= 0:
                prev_c_rev = self.computed.filtered_revs[prev_c_rev_f_index]

            tags = []
            # Branch labels
            tags.extend([(label, QtGui.QColor(24, 80, 200),
                          QtGui.QColor(QtCore.Qt.white))
                         for (branch_info, label) in c_rev.branch_labels
                         if label])
            # Tags
            if c_rev.rev.revid in self.graph_viz.tags:
                tags.extend([(tag, QtGui.QColor(80, 128, 32),
                              QtGui.QColor(QtCore.Qt.white))
                             for tag in self.graph_viz.tags[c_rev.rev.revid]])

            # Bugs
            if revision:
                if hasattr(revision, '_qlog_bugs'):
                    bugs = revision._qlog_bugs
                else:
                    bugs = []
                    for bug in revision.properties.get('bugs', '').split('\n'):
                        if bug:
                            url = bug.split(' ', 1)[0]
                            bug_id = get_bug_id(url)
                            if bug_id:
                                bugs.append(self.bugtext % bug_id)
                    revision._qlog_bugs = bugs
                tags.extend([(bug, QtGui.QColor(164, 0, 0),
                              QtGui.QColor(QtCore.Qt.white)) for bug in bugs])
            is_clicked = c_rev.f_index == self.clicked_f_index

            return (c_rev, prev_c_rev, tags, is_clicked)

        if (role == QtCore.Qt.DisplayRole and index.column() == COL_REV):
            return c_rev.rev.revno_str

        if role == QtCore.Qt.ToolTipRole and index.column() == COL_MESSAGE:
            urls = [
                branch_info.branch.base
                for (branch_info, label) in c_rev.branch_labels if label
            ]
            return '\n'.join(urls)

        if role == RevIdRole:
            return c_rev.rev.revid

        #Everything from here foward will need to have the revision loaded.
        if revision is None:
            return blank()

        if role == QtCore.Qt.DisplayRole and index.column() == COL_DATE:
            return strftime("%Y-%m-%d %H:%M", localtime(revision.timestamp))
        if role == QtCore.Qt.DisplayRole and index.column() == COL_AUTHOR:
            return extract_name(get_apparent_author(revision))
        if role == QtCore.Qt.DisplayRole and index.column() == COL_MESSAGE:
            return revision.get_summary()

        return blank()
예제 #3
0
 def test_jira(self):
     self.assertEqual('AB-1234',
                      get_bug_id('http://jiraserver/browse/AB-1234'))
     self.assertEqual('A_B-1234',
                      get_bug_id('http://jiraserver/browse/A_B-1234'))
     self.assertEqual('AB_1-1234',
                      get_bug_id('http://jiraserver/browse/AB_1-1234'))
     self.assertEqual('AB_1A-1234',
                      get_bug_id('http://jiraserver/browse/AB_1A-1234'))
     self.assertEqual(None, get_bug_id('http://jiraserver/browse/1A-1234'))
     self.assertEqual(None, get_bug_id('http://jiraserver/browse/_1A-1234'))
     self.assertEqual(None, get_bug_id('http://jiraserver/browse/A-1234A'))
     self.assertEqual(None, get_bug_id('http://jiraserver/browse/a-1'))
     self.assertEqual(None, get_bug_id('http://jiraserver/browse/a'))
     self.assertEqual(None, get_bug_id('http://jiraserver/browse/A'))
     self.assertEqual(None, get_bug_id('http://jiraserver/browse/A-'))
     self.assertEqual(None, get_bug_id('http://jiraserver/browse/A_1'))
     self.assertEqual('A-1', get_bug_id('http://jiraserver/browse/A-1'))
     self.assertEqual(
         'ZZ12_SA__2__-122222222',
         get_bug_id('http://jiras1212erver/browse/ZZ12_SA__2__-122222222'))
예제 #4
0
 def test_fusionforge(self):
     self.assertEqual(
         '292',
         get_bug_id(
             'https://fusionforge.org/tracker/index.php?func=detail&aid=292'
         ))
예제 #5
0
 def test_roundup(self):
     self.assertEqual('5243',
                      get_bug_id('http://bugs.python.org/issue5243'))
예제 #6
0
 def test_mantis(self):
     self.assertEqual(
         '7721',
         get_bug_id('http://www.mantisbt.org/bugs/view.php?id=7721'))
     self.assertEqual('123', get_bug_id('http://localhost/view.php?id=123'))
예제 #7
0
 def test_fogbugz(self):
     self.assertEqual(
         '1234', get_bug_id('http://test.fogbugz.com/default.asp?1234'))
예제 #8
0
 def test_redmine(self):
     self.assertEqual('1832',
                      get_bug_id('http://www.redmine.org/issues/show/1832'))
     self.assertEqual('6', get_bug_id('https://rm.ftrahan.com/issues/6'))
예제 #9
0
 def test_bugzilla(self):
     self.assertEqual(
         '169104', get_bug_id('http://bugs.kde.org/show_bug.cgi?id=169104'))
예제 #10
0
 def test_trac(self):
     self.assertEqual('3852',
                      get_bug_id('http://bugs.musicbrainz.org/ticket/3852'))
예제 #11
0
 def test_launchpad(self):
     self.assertEqual('261234',
                      get_bug_id('https://launchpad.net/bugs/261234'))