Mgrover has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/75280


Change subject: added additional logic to grep the output file for Story and Bug
......................................................................

added additional logic to grep the output file for Story and Bug

Change-Id: I0238ead73870265880a0a6fbbaa2d8e2e6facad9
---
M python-git-logs/log_updates.py
1 file changed, 27 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/release 
refs/changes/80/75280/1

diff --git a/python-git-logs/log_updates.py b/python-git-logs/log_updates.py
index 56c804f..1a6c225 100755
--- a/python-git-logs/log_updates.py
+++ b/python-git-logs/log_updates.py
@@ -3,48 +3,62 @@
 from subprocess import check_output
 from datetime import date
 import re
+import glob
+
 
 def info(str):
-   print "[INFO] %s" % str
+    print "[INFO] %s" % str
+
 
 def get_initial_commit(repodir):
-    the_commit = raw_input('Please enter commit number or <ENTER> for 
last-update: ')
+    the_commit = raw_input('Enter commit number or <ENTER> for last-update: ')
     if len(the_commit) == 0:
-       the_commit = latest_commit(repodir)
+        the_commit = latest_commit(repodir)
     else:
-       info('Using %s as the initial commit.' % the_commit)
+        info('Using %s as the initial commit.' % the_commit)
     return the_commit
+
 
 def latest_commit(repodir):
     info("Aquiring latest commit number...")
-    cmd = ['git','log', '--max-count=1']
+    cmd = ['git', 'log', '--max-count=1']
     last_log_output = check_output(cmd)
     m = re.search('commit\s+([a-z0-9]+).*', last_log_output)
     last_commit = m.group(1)
     info('Using the last commit [%s] as the initial commit.' % last_commit)
     return last_commit
 
+
 def get_log_since(last_updated, repodir):
     info("Getting latest delta logs ...")
-    cmd = ['git','log', '--no-merges',"%s.." % last_updated]
+    cmd = ['git', 'log', '--no-merges', "%s.." % last_updated]
     log = check_output(cmd)
     return log
 
+
 def output_change_log(f_name, change_log):
-     info("Writing %s ..." % f_name)
-     hLog = open(f_name, 'w')
-     hLog.write(change_log)
-     hLog.close()
-     info("Done.")
+    info("Writing %s ..." % f_name)
+    hLog = open(f_name, 'w')
+    hLog.write(change_log)
+    hLog.close()
+    info("Done.")
+
 
 def generate_change_log(repodir):
     last_updated = get_initial_commit(repodir)
-    change_log = get_log_since(last_updated,repodir)
+    change_log = get_log_since(last_updated, repodir)
 
     f_name = 'ChangeLogs_%s.txt' % date.today().isoformat()
     output_change_log(f_name, change_log)
+    return output_change_log
 
 
+def grep_change_log_file():
+    files = glob.glob("*.txt")
+    for line in open(files[0], 'r'):
+        if re.findall(r"(?i)Story|(?i)Bug", line):
+            print line
 
 if __name__ == '__main__':
-  generate_change_log('.')
+    generate_change_log('.')
+    grep_change_log_file()

-- 
To view, visit https://gerrit.wikimedia.org/r/75280
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0238ead73870265880a0a6fbbaa2d8e2e6facad9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/tools/release
Gerrit-Branch: master
Gerrit-Owner: Mgrover <mgro...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to