summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Doan <andy.doan@linaro.org>2015-05-29 14:39:36 -0500
committerAndy Doan <andy.doan@linaro.org>2015-06-05 14:33:46 -0500
commit54555f4bbee80e79c8694f8c18f1ef02aca9fb36 (patch)
tree9a8dcae4e7f8f79f96076792b248bd9a30144549
parent24232ceaa2496795629a166ffb00bb49ac306978 (diff)
downloadlinaro-patchmetrics-54555f4bbee80e79c8694f8c18f1ef02aca9fb36.tar.gz
add more fine-grained handling of update-committed-patches
At times we need to debug this command to see why certain patches get missed. This change allows us to target the new commits for a specific project, or just parse through a specific list of commits in a project. With this change you can now try something like: update-committed-patches.py quemu-devell commit_xxx and have the code try and handle commit_xxx Change-Id: I778a0eaeb008aea8bf98feaa9ac980dcd8d782f0
-rwxr-xr-xapps/patchwork/bin/update-committed-patches.py27
1 files changed, 24 insertions, 3 deletions
diff --git a/apps/patchwork/bin/update-committed-patches.py b/apps/patchwork/bin/update-committed-patches.py
index 1e3c6eb..d53cc8b 100755
--- a/apps/patchwork/bin/update-committed-patches.py
+++ b/apps/patchwork/bin/update-committed-patches.py
@@ -9,6 +9,7 @@
# accepted into sub-maintainer/custodian branches will only be marked as
# accepted once they reach the master branch.
+import argparse
import os
import sys
@@ -36,6 +37,14 @@ from patchwork.utils import (
def main():
+ parser = argparse.ArgumentParser(
+ description='Find patches that have been committed upstream')
+ parser.add_argument('project', nargs='?',
+ help='only check on specific project')
+ parser.add_argument('commit_id', nargs='*',
+ help='only check on given commit')
+ args = parser.parse_args()
+
if settings.AUTH_CROWD_APPLICATION_USER is None:
print >> sys.stderr, ("AUTH_CROWD_APPLICATION_USER not defined in "
"settings.py.\n")
@@ -46,12 +55,24 @@ def main():
settings.AUTH_CROWD_SERVER_REST_URI)
cache_db = PatchworkDB()
- projects = Project.objects.exclude(
- Q(source_tree__isnull=True) | Q(source_tree=''))
+ if args.project:
+ projects = Project.objects.filter(linkname=args.project)
+ else:
+ projects = Project.objects.exclude(
+ Q(source_tree__isnull=True) | Q(source_tree=''))
rc = 1
with cache_db:
- rc = _update(crwd, projects, cache_db)
+ if args.commit_id:
+ try:
+ root = ensure_source_checkout_for_project(projects[0])
+ _update_project_commits(
+ crwd, cache_db, projects[0], root, args.commit_id)
+ except Exception as e:
+ sys.stderr.write(str(e) + "\n")
+ rc = 1
+ else:
+ rc = _update(crwd, projects, cache_db)
return rc