[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdepim/enterprise/e3] /
From:       Sergio Martins <iamsergio () gmail ! com>
Date:       2011-01-21 21:00:02
Message-ID: 20110121210002.B4D80A6092 () git ! kde ! org
[Download RAW message or body]

Git commit 61f1b42a360da2f59811dd3cdabcfa643a09ee77 by Sergio Martins
Pushed by smartins into branch enterprise/e3

Added a script that builds the avail list.

A  +58   -0    availlist.py         [License: UNKNOWN]

http://commits.kde.org/ee6cc38b/61f1b42a360da2f59811dd3cdabcfa643a09ee77

diff --git a/availlist.py b/availlist.py
new file mode 100644
index 0000000..3d1020c
--- /dev/null
+++ b/availlist.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+# Tested with python2 and python3
+
+import os
+
+def run_git_notes_list():
+    return os.popen( 'git notes list' ).readlines()
+
+def run_git_show( commit, include_notes ):
+    if include_notes:
+        return os.popen( 'git show --name-only ' + commit ).readlines()
+    else:
+        return os.popen( 'git show --no-notes --name-only ' + commit ).readlines()
+
+# Returns True if this is a PENDING note.
+def is_relevant_note( note_lines ):
+    for note_line in note_lines:
+        if 'PENDING' in note_line:
+            return True
+    return False
+
+# Parses "git notes list" output and returns a list of commits with notes
+def get_objects_with_notes():
+    git_notes_output = run_git_notes_list()
+
+    result = []
+    for line in git_notes_output:
+        line = line.strip() #remove '\n'
+        splited_line = line.split()
+        if len(splited_line) == 2:
+            result.append( splited_line[1] )
+        else:
+            print( "Invalid line: " + line )
+
+    return result
+
+# Returns the avail list
+def get_avail_list():
+    commits = get_objects_with_notes()
+
+    result = []
+    separator = '---------------------------------------------------------------------'
+    print( separator )
+    for commit in commits:
+        lines = run_git_show( commit, True )
+        if is_relevant_note( lines ):
+            result = result + run_git_show( commit, False )
+            result.append( separator )
+    return result
+
+# Prints the avail list
+def print_avail_list():
+    lines = get_avail_list()
+    for line in lines:
+        print( line.strip() )
+
+
+print_avail_list()
\ No newline at end of file

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic