1 new commit in pytest:

https://bitbucket.org/hpk42/pytest/commits/fbff0a016b3b/
Changeset:   fbff0a016b3b
User:        hpk42
Date:        2013-11-18 21:31:32
Summary:     a script to read bitbucket pytest issues
Affected #:  1 file

diff -r 89b0f6f0e7d8a87edd3fb9d1dcaa8c58d1ed0361 -r 
fbff0a016b3bff6d6ccfa36f66249508689b7ee8 extra/get_issues.py
--- /dev/null
+++ b/extra/get_issues.py
@@ -0,0 +1,73 @@
+import json
+import py
+import textwrap
+
+issues_url = "http://bitbucket.org/api/1.0/repositories/hpk42/pytest/issues";
+
+import requests
+
+def get_issues():
+    chunksize = 50
+    start = 0
+    issues = []
+    while 1:
+        post_data = {"accountname": "hpk42",
+                     "repo_slug": "pytest",
+                     "start": start,
+                     "limit": chunksize}
+        print ("getting from", start)
+        r = requests.get(issues_url, params=post_data)
+        data = r.json()
+        issues.extend(data["issues"])
+        if start + chunksize >= data["count"]:
+            return issues
+        start += chunksize
+
+kind2num = "bug enhancement task proposal".split()
+
+status2num = "new open resolved duplicate invalid wontfix".split()
+
+def main(args):
+    cachefile = py.path.local(args.cache)
+    if not cachefile.exists() or args.refresh:
+        issues = get_issues()
+        cachefile.write(json.dumps(issues))
+    else:
+        issues = json.loads(cachefile.read())
+
+    open_issues = [x for x in issues
+                    if x["status"] in ("new", "open")]
+
+    def kind_and_id(x):
+        kind = x["metadata"]["kind"]
+        return kind2num.index(kind), len(issues)-int(x["local_id"])
+    open_issues.sort(key=kind_and_id)
+    report(open_issues)
+
+def report(issues):
+    for issue in issues:
+        metadata = issue["metadata"]
+        priority = issue["priority"]
+        title = issue["title"]
+        content = issue["content"]
+        kind = metadata["kind"]
+        status = issue["status"]
+        id = issue["local_id"]
+        link = "https://bitbucket.org/hpk42/pytest/issues/%s/"; % id
+        print("----")
+        print(status, kind, link)
+        print(title)
+        #print()
+        #lines = content.split("\n")
+        #print ("\n".join(lines[:3]))
+        #if len(lines) > 3 or len(content) > 240:
+        #    print ("...")
+
+if __name__ == "__main__":
+    import argparse
+    parser = argparse.ArgumentParser("process bitbucket issues")
+    parser.add_argument("--refresh", help="invalidate cache, refresh issues")
+    parser.add_argument("--cache", action="store", default="issues.json",
+                        help="cache file")
+    args = parser.parse_args()
+    main(args)

Repository URL: https://bitbucket.org/hpk42/pytest/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
pytest-commit mailing list
pytest-commit@python.org
https://mail.python.org/mailman/listinfo/pytest-commit

Reply via email to