- def get_last_tag(self):
- tags_str = self.exec_cmd('git-tag')
- tags = tags_str.splitlines()
-
- return tags[len(tags)-1]
-
- def get_commits(self):
- bugs = ''
- co = None
- commits = []
- last_tag = self.get_last_tag()
-
- changes = self.exec_cmd ("git-log " + last_tag + "..")
- for line in changes.splitlines(1):
- if line.startswith('commit'):
- if co != None:
- bug = co.parse()
- if bug:
- if bugs != '':
- bugs += ','
- bugs += bug
-
- co = Commit()
- commits.append(co)
- p1 = line.find(' ')
- co.ref = line[p1:].strip()
- elif line.startswith('Author:'):
- p1 = line.find(' ')
- p2 = line.find('<')
- co.author = line[p1:p2].strip()
- elif line.startswith('Date:'):
- p1 = line.find(' ')
- co.date = line[p1:].strip()
- elif line.startswith(' git-svn-id:'):
- continue
- elif line.startswith('Merge:'):
- continue
- else:
- msg = line.strip()
- if msg == '':
- continue
- if msg.startswith('*'):
- p1 = msg.find(':')
- msg = msg[p1 + 1:].strip()
- elif msg.startswith('2007-') or msg.startswith('2008-'):
- continue
- if co.message != '':
- co.message += '\n'
- co.message += msg
-
- # 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)