Jdlrobson has uploaded a new change for review.
https://gerrit.wikimedia.org/r/95744
Change subject: Add more context to bug reports, group other commits
......................................................................
Add more context to bug reports, group other commits
This makes the script a little bit more clever. It uses change
ids to work out the end of a commit and allow you to see the entire
commit. Without this the links to bugs don't provide more information
on what they do
Change-Id: Iff58f23a5aeed9865425388cff3b2bddef675197
---
M git-logs/log_updates.py
1 file changed, 31 insertions(+), 7 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/release
refs/changes/44/95744/1
diff --git a/git-logs/log_updates.py b/git-logs/log_updates.py
index 21ba7e9..0d7766d 100755
--- a/git-logs/log_updates.py
+++ b/git-logs/log_updates.py
@@ -10,7 +10,7 @@
STORY_URL = '//wikimedia.mingle.thoughtworks.com/projects/mobile/cards/%s'
BUG_URL = '//bugzilla.wikimedia.org/show_bug.cgi?id=%s'
headings = ["dependencies", "stories", "bugs", "qa", "hygiene", "i18n",
- "regressions"]
+ "regressions", "other"]
def info(msg):
@@ -61,13 +61,32 @@
output_change_log(f_name, change_log)
return f_name
-
def grep_change_log_file(f_name):
log = {}
for heading in headings:
log[heading] = []
f = open(f_name, 'r')
+ commits = []
+ commit = []
for line in f:
+ # changeids always finish a commit
+ if re.findall(r"Change-Id:", line):
+ commits.append(commit)
+ commit = []
+ else:
+ commit.append(line)
+
+ for commit in commits:
+ grep_commit(log,commit)
+ f = open(f_name, 'r')
+ log["raw"] = f.read()
+ f.close()
+ return log
+
+def grep_commit(log,commit):
+ ignored_lines = 0
+ commit_lines = len(commit)
+ for line in commit:
if re.findall(r"(?i)Story ([0-9]*)[^:]*:", line):
matches = re.findall(r"(?i)Story ([0-9]*)[^:]*:", line)
if len(matches) == 1:
@@ -78,7 +97,8 @@
matches = re.findall(r"(?i)Bug: ([0-9]*)", line)
if len(matches) == 1:
url = BUG_URL % matches[0]
- line = '[%s %s]' % (url, line.strip())
+ line = '[%s %s]\n' % (url, line.strip())
+ line += ' '.join(commit)
log["bugs"].append(line)
elif re.findall(r"(?i)QA", line):
log["qa"].append(line)
@@ -92,9 +112,11 @@
url = DEPENDENCY_URL % matches[0]
line = '[%s %s]' % (url, line.strip())
log["dependencies"].append(line)
- f = open(f_name, 'r')
- log["raw"] = f.read()
- f.close()
+ else:
+ ignored_lines += 1
+ # If all the lines were ignored it didn't go into a bucket
+ if commit_lines == ignored_lines:
+ log["other"].append( ' '.join( commit ) )
return log
@@ -105,7 +127,9 @@
if len(log[heading]) > 0:
out += '== %s ==\n\n' % heading.capitalize()
for commit in log[heading]:
- out += '* %s\n' % commit
+ if commit.count( '\n' ) == 0:
+ out += '*'
+ out += '%s\n' % commit
out += '== Raw git log ==\n\n'
out += log["raw"]
return out
--
To view, visit https://gerrit.wikimedia.org/r/95744
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iff58f23a5aeed9865425388cff3b2bddef675197
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/tools/release
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits