- def get_last_tag(self):
- tags_str = self.exec_cmd('git-tag')
- tags = tags_str.splitlines()
-
- return tags[len(tags)-1]
-
- def parse_commit(self, ref, author, date, message):
- p1 = message.rfind('(')
- p2 = message.rfind (')')
- if len(message) - p2 <= 2 and \
- message[p1+1:].find('#') == -1:
- author = message[p1+1:p2]
- message = message[:p1]
-
- msg = message.lower()
- if msg.find('translation') != -1 and \
- (msg.find('added') != -1 or \
- msg.find('updated') != -1):
- self.translations += ' - ' + message + ' (' + author + ').\n'
- elif message.find('#') != -1:
- p1 = message.find('#')
- while p1 != -1:
- bug = Bug()
- p2 = p1 + 1
- while message[p2].isdigit():
- p2 = p2 + 1
- bug.number = message[p1+1:p2]
- bug.author = author
- self.bug_commits.append(bug)
- p1 = message.find('#', p2)
- else:
- self.commits += ' - ' + message + ' (' + author + ').\n'
-
- def query_bug_commits(self):
- bugs = ''
- for bug in self.bug_commits:
- bugs += bug.number + ','
-
- # Bugzilla query to use
- query = 'http://bugzilla.gnome.org/buglist.cgi?ctype=csv' \
- '&bug_status=RESOLVED,CLOSED,VERIFIED' \
- '&resolution=FIXED' \
- '&bug_id=' + bugs.replace(',', '%2c')
-
+ def get_translations(self, cmd, format):
+ translations = ''
+ files_str = self.exec_cmd(cmd)
+ files = files_str.splitlines()
+ for line in files:
+ f = line[line.rfind(' '):]
+ lang = f[f.rfind('/')+1:f.rfind('.')]
+ commit_str = self.exec_cmd("git log %s.. %s" % (self.last_tag, f))
+ if commit_str == '':
+ continue
+
+ authors = ''
+ for line in commit_str.splitlines():
+ if line.startswith('Author:'):
+ p1 = line.find(' ')
+ p2 = line.find('<')
+ author = line[p1:p2].strip()
+
+ if authors.find(author) != -1:
+ continue
+ if authors != '':
+ authors += ", "
+ authors += author
+
+ translations += format % (lang, authors)
+ return translations
+
+ def get_bug_author(self, bug_number):
+ cmd = 'git log %s.. | grep -B 20 -E \
+ "(bug %s|#%s)|bugzilla.gnome.org/show_bug.cgi\?id=%s"' \
+ ' | tac | grep ^Author: | head -1' \
+ % (self.last_tag, bug_number, bug_number, bug_number)
+ line = self.exec_cmd (cmd)
+ p1 = line.find(" ")
+ p2 = line.find("<")
+
+ return line[p1:p2].strip()
+
+ def get_bugs(self):
+ commit_str = self.exec_cmd('git show %s' % (self.last_tag))
+ for line in commit_str.splitlines():
+ if line.startswith('Date:'):
+ time_str = line[5:line.rfind('+')].strip()
+ t = time.strptime(time_str)
+ last_tag_date = time.strftime('%Y-%m-%d', t)
+ break
+
+ query = 'http://bugzilla.gnome.org/buglist.cgi?' \
+ 'ctype=csv&product=empathy&' \
+ 'bug_status=RESOLVED,CLOSED,VERIFIED&resolution=FIXED&' \
+ 'chfieldfrom=%s&chfieldto=Now' % (last_tag_date)