jenkins-bot has submitted this change and it was merged.

Change subject: git-logs: support commit ranges
......................................................................


git-logs: support commit ranges

Generecize commit handling, allowing user to supply ranges.

NB that if you don't provide a range (eg a single SHA1), '..' will be
appended when running git-log.

Change-Id: Ie7b8be9cef5731fbd2824820395ed8316322b7de
---
M git-logs/log_updates.py
1 file changed, 14 insertions(+), 12 deletions(-)

Approvals:
  Hashar: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/git-logs/log_updates.py b/git-logs/log_updates.py
index 9dc778e..ef676ac 100755
--- a/git-logs/log_updates.py
+++ b/git-logs/log_updates.py
@@ -18,20 +18,22 @@
     print "[INFO] %s" % msg
 
 
-def get_initial_commit(repodir, the_commit=None):
-    if not the_commit:
+def get_commit_range(repodir, commit=None):
+    if not commit:
         prompt = 'Enter commit number or <ENTER> for last-update: '
-        the_commit = raw_input(prompt)
-    if len(the_commit) == 0:
-        the_commit = latest_commit(repodir)
+        commit = raw_input(prompt)
+    if len(commit) == 0:
+        commit = latest_commit(repodir)
     else:
-        info('Using %s as the initial commit.' % the_commit)
-    return the_commit
+        info('Using %s as the initial commit.' % commit)
+    if len(commit.split('..')) < 2:
+        commit = '%s..' % commit
+    return commit
 
 
 def latest_commit(repodir):
     info("Aquiring latest commit number...")
-    cmd = ['git', 'log', '--max-count=1']
+    cmd = ['git', 'log', '--max-count=1', '--no-merges']
     last_log_output = check_output(cmd)
     m = re.search('commit\s+([a-z0-9]+).*', last_log_output)
     last_commit = m.group(1)
@@ -39,9 +41,9 @@
     return last_commit
 
 
-def get_log_since(last_updated, repodir):
+def get_log_from_range(commit_range):
     info("Getting latest delta logs ...")
-    cmd = ['git', 'log', '--no-merges', "%s.." % last_updated]
+    cmd = ['git', 'log', '--no-merges', "%s" % commit_range]
     log = check_output(cmd)
     return log
 
@@ -55,8 +57,8 @@
 
 
 def generate_change_log(repodir, commit=None):
-    last_updated = get_initial_commit(repodir, commit)
-    change_log = get_log_since(last_updated, repodir)
+    commit_range = get_commit_range(repodir, commit)
+    change_log = get_log_from_range(commit_range)
 
     f_name = 'ChangeLogs_%s.txt' % date.today().isoformat()
     output_change_log(f_name, change_log)

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie7b8be9cef5731fbd2824820395ed8316322b7de
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/tools/release
Gerrit-Branch: master
Gerrit-Owner: Awjrichards <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to