Mgrover has submitted this change and it was merged.
Change subject: Created python script to git logs
......................................................................
Created python script to git logs
Change-Id: I3c29ac28960c9196a0f7b0c1c634344ca961cb49
---
A git-logs/README
A git-logs/log_updates.py
2 files changed, 65 insertions(+), 0 deletions(-)
Approvals:
Mgrover: Verified; Looks good to me, approved
jenkins-bot: Verified
diff --git a/git-logs/README b/git-logs/README
new file mode 100644
index 0000000..ff7f427
--- /dev/null
+++ b/git-logs/README
@@ -0,0 +1,9 @@
+This is a script to pull the git logs from for a branch.
+It's really just a fancier way of running
+'git log --no-merges commitId..> ChangeLogsYYYY-MM-DD'.
+You can enter a commit Id or press <ENTER> to retrieve the latest stored
commit Id.
+
+
+Usage:
+ ./log_updates.py
+
diff --git a/git-logs/log_updates.py b/git-logs/log_updates.py
new file mode 100755
index 0000000..3673442
--- /dev/null
+++ b/git-logs/log_updates.py
@@ -0,0 +1,56 @@
+#!/usr/bin/python
+
+from subprocess import check_output
+from datetime import date
+import re
+
+
+def info(msg):
+ print "[INFO] %s" % msg
+
+
+def get_initial_commit():
+ the_commit = raw_input('Please enter commit number or '
+ '<ENTER> for last-update: ')
+ if len(the_commit) == 0:
+ the_commit = latest_commit()
+ else:
+ info('Using %s as the initial commit.' % the_commit)
+ return the_commit
+
+
+def latest_commit():
+ info("Aquiring latest commit number...")
+ 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):
+ info("Getting latest delta logs ...")
+ 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.")
+
+
+def generate_change_log():
+ last_updated = get_initial_commit()
+ change_log = get_log_since(last_updated)
+
+ f_name = 'ChangeLogs_%s.txt' % date.today().isoformat()
+ output_change_log(f_name, change_log)
+
+
+if __name__ == '__main__':
+ generate_change_log('.')
--
To view, visit https://gerrit.wikimedia.org/r/59138
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I3c29ac28960c9196a0f7b0c1c634344ca961cb49
Gerrit-PatchSet: 11
Gerrit-Project: mediawiki/tools/release
Gerrit-Branch: master
Gerrit-Owner: Mgrover <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: Mgrover <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits