From 61495065ece5481526db9f61d9e94eb2e54a0372 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Wed, 15 Dec 2010 14:50:54 +0000 Subject: [PATCH] grep-merges: New tool. --- debian/changelog | 3 +++ debian/control | 1 + debian/copyright | 20 ++++++++++---------- doc/grep-merges.1 | 20 ++++++++++++++++++++ grep-merges | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 80 insertions(+), 10 deletions(-) create mode 100644 doc/grep-merges.1 create mode 100755 grep-merges diff --git a/debian/changelog b/debian/changelog index ac1ce83..8445f16 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,9 @@ ubuntu-dev-tools (0.108) UNRELEASED; urgency=low * pull-lp-source: Unquote URI to get "+" instead of "%2B" in the file name (LP: #681114). + [ Colin Watson ] + * grep-merges: New tool. + -- Benjamin Drung Tue, 14 Dec 2010 18:21:37 +0100 ubuntu-dev-tools (0.107) experimental; urgency=low diff --git a/debian/control b/debian/control index 85f6964..5f0959f 100644 --- a/debian/control +++ b/debian/control @@ -62,6 +62,7 @@ Description: useful tools for Ubuntu developers - grab-attachments - download all bug attachments from a Launchpad bug report. - grab-merge - grabs a merge from merges.ubuntu.com easily. + - grep-merges - search for pending merges from Debian. - hugdaylist - compile HugDay lists from bug list URLs. - import-bug-from-debian - copy a bug from the Debian BTS to Launchpad - lp-list-bugs - briefly list status of Launchpad bugs. diff --git a/debian/copyright b/debian/copyright index 949ced8..b9bf90f 100644 --- a/debian/copyright +++ b/debian/copyright @@ -81,11 +81,11 @@ On Debian and Ubuntu systems, the complete text of the GNU General Public License v2 can be found in `/usr/share/common-licenses/GPL-2'. dch-repeat, errno, get-branches, get-build-deps, grab-attachments, grab-merge, -hugdaylist, lp-list-bugs, manage-credentials, massfile, merge-changelog, -mk-sbuild, pbuilder-dist-simple, pull-debian-debdiff, pull-debian-source, -pull-lp-source, pull-revu-source, setup-packaging-environment, -suspicious-source, ubuntu-build and what-patch are licensed under the GNU -General Public License, version 3: +grep-merges, hugdaylist, lp-list-bugs, manage-credentials, massfile, +merge-changelog, mk-sbuild, pbuilder-dist-simple, pull-debian-debdiff, +pull-debian-source, pull-lp-source, pull-revu-source, +setup-packaging-environment, suspicious-source, ubuntu-build and what-patch +are licensed under the GNU General Public License, version 3: This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -101,8 +101,8 @@ License v3 can be found in `/usr/share/common-licenses/GPL-3'. The following scripts can be used, at your option, regarding any later version of the previously specified license: 404main, dch-repeat, dgetlp, -get-build-deps, import-bug-from-debian, lp-list-bugs, lp-project-upload, -lp-set-dup, manage-credentials, mk-sbuild-lv, pbuilder-dist, -pull-debian-debdiff, pull-debian-source, pull-lp-source, pull-revu-source, -reverse-build-depends, setup-packaging-environment, submittodebian, -suspicious-source, syncpackage, ubuntu-build, what-patch. +get-build-deps, grep-merges, import-bug-from-debian, lp-list-bugs, +lp-project-upload, lp-set-dup, manage-credentials, mk-sbuild-lv, +pbuilder-dist, pull-debian-debdiff, pull-debian-source, pull-lp-source, +pull-revu-source, reverse-build-depends, setup-packaging-environment, +submittodebian, suspicious-source, syncpackage, ubuntu-build, what-patch. diff --git a/doc/grep-merges.1 b/doc/grep-merges.1 new file mode 100644 index 0000000..b599160 --- /dev/null +++ b/doc/grep-merges.1 @@ -0,0 +1,20 @@ +.TH grep\-merges 1 "December 15, 2010" "ubuntu-dev-tools" +.SH NAME +grep\-merges \- search for outstanding merges from Debian +.SH SYNOPSIS +.B grep\-merges +.RI [ pattern ] +.SH DESCRIPTION +.B grep\-merges +searches merges.ubuntu.com for pending merges from Debian. +If a +.I pattern +is given, it will list all merges whose source package name, last changelog +author, or last uploader match that pattern. +Otherwise, it will list all merges. +.SH AUTHOR +.B grep\-merges +and this manual page were written by Colin Watson . +.PP +Both are released under the terms of the GNU General Public License, version +3 or (at your option) any later version. diff --git a/grep-merges b/grep-merges new file mode 100755 index 0000000..19a8a62 --- /dev/null +++ b/grep-merges @@ -0,0 +1,46 @@ +#! /usr/bin/python +# +# grep-merges - search for pending merges from Debian +# +# Copyright (C) 2010 Canonical Ltd. +# Authors: +# - Colin Watson +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +import sys +import urllib2 +import json + +if len(sys.argv) > 1: + match = sys.argv[1] +else: + match = None + +for component in ('main', 'main-manual', + 'restricted', 'restricted-manual', + 'universe', 'universe-manual', + 'multiverse', 'multiverse-manual'): + page = urllib2.urlopen('http://merges.ubuntu.com/%s.json' % component) + for merge in json.load(page): + package = merge['source_package'] + author, uploader = '', '' + if 'user' in merge: + author = merge['user'] + if 'uploader' in merge: + uploader = '(%s)' % merge['uploader'] + pretty_uploader = ' '.join((author, uploader)).strip() + if (match is None or + match in package or match in author or match in uploader): + print '%s\t%s' % (package, pretty_uploader)