grep-merges: New tool.

This commit is contained in:
Colin Watson 2010-12-15 14:50:54 +00:00
parent 4e7c58085e
commit 61495065ec
5 changed files with 80 additions and 10 deletions

3
debian/changelog vendored
View File

@ -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 <bdrung@ubuntu.com> Tue, 14 Dec 2010 18:21:37 +0100
ubuntu-dev-tools (0.107) experimental; urgency=low

1
debian/control vendored
View File

@ -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.

20
debian/copyright vendored
View File

@ -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.

20
doc/grep-merges.1 Normal file
View File

@ -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 <cjwatson@ubuntu.com>.
.PP
Both are released under the terms of the GNU General Public License, version
3 or (at your option) any later version.

46
grep-merges Executable file
View File

@ -0,0 +1,46 @@
#! /usr/bin/python
#
# grep-merges - search for pending merges from Debian
#
# Copyright (C) 2010 Canonical Ltd.
# Authors:
# - Colin Watson <cjwatson@ubuntu.com>
#
# 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 <http://www.gnu.org/licenses/>.
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)