[PATCH 1/2] Add rudimentary support for redmine.
Clint Adams
schizo at debian.org
Mon Dec 14 08:36:32 UTC 2009
---
README | 2 +-
htdocs/index.txt | 4 ++-
remote/base.py | 2 +-
remote/redmine.py | 59 +++++++++++++++++++++++++++++++++++++++++++++++=
++++++
4 files changed, 64 insertions(+), 3 deletions(-)
create mode 100644 remote/redmine.py
diff --git a/README b/README
index 6224708..aca645f 100644
--- a/README
+++ b/README
@@ -59,7 +59,7 @@ ldap =3D ldap://bts2ldap.debian.net:10101
Bugtracker configuration properties
-----------------------------------
For each bugtracker, several configuration values can be defined :
- - type : the bugtracker's type (berlios, bugzilla, gnats, launchpad, ma=
ntis, rt, savane, sourceforge, trac or gforge)
+ - type : the bugtracker's type (berlios, bugzilla, gnats, launchpad, ma=
ntis, rt, savane, sourceforge, trac, gforge, jira, or redmine)
- uri : the base URL of the bugtracker
- uri-re (optional) : a regexp describing the bugtracker's bugs URLs is=
olating the bug number/id=20
=20
diff --git a/htdocs/index.txt b/htdocs/index.txt
index 8b2751e..dcff36c 100644
--- a/htdocs/index.txt
+++ b/htdocs/index.txt
@@ -38,7 +38,9 @@ was written, 'bts-link' supports:
- savane (from savanah);
- sourceforge trackers;
- trac;
-- gforge (and fusionforge most probably).
+- gforge (and fusionforge most probably);
+- jira;
+- redmine.
=20
=20
How does it work ?
diff --git a/remote/base.py b/remote/base.py
index c06c7a6..0d1f5c1 100644
--- a/remote/base.py
+++ b/remote/base.py
@@ -393,4 +393,4 @@ class RemoteBts:
return data.id
=20
# Import all bugtracker classes which will in turn register with RemoteB=
ts.register()
-import berlios, bugzilla, gnats, launchpad, mantis, rt, savane, sourcefo=
rge, trac, gforge, googlecode, roundup, misc, flyspray, jira
+import berlios, bugzilla, gnats, launchpad, mantis, rt, savane, sourcefo=
rge, trac, gforge, googlecode, roundup, misc, flyspray, jira, redmine
diff --git a/remote/redmine.py b/remote/redmine.py
new file mode 100644
index 0000000..621f9cf
--- /dev/null
+++ b/remote/redmine.py
@@ -0,0 +1,59 @@
+# vim:set encoding=3Dutf-8:
+########################################################################=
#######
+# Copyright:
+# =A9 2009 Clint Adams <schizo at debian.org>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution=
.
+# 3. The names of its contributors may not be used to endorse or promote
+# products derived from this software without specific prior written
+# permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND ANY EXPRES=
S OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANT=
IES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. =
IN NO
+# EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCID=
ENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMIT=
ED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PRO=
FITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILIT=
Y,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE O=
R
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+########################################################################=
#######
+
+import urllib, urlparse, cgi
+
+from BeautifulSoup import BeautifulSoup
+from __init__ import *
+
+def parse_table(soup, key):
+ cell =3D soup.first('td', {'class':key})
+ return cell.string
+
+class RedmineData:
+ def __init__(self, uri, id):
+ soup =3D BeautifulSoup(urllib.urlopen(uri))
+
+ self.id =3D id or failwith(uri, "Redmine: no id")
+ self.status =3D parse_table(soup, 'status') or failwith(uri, "Re=
dmine", exn=3DNoStatusExn)
+ self.resolution =3D None
+
+class RemoteRedmine(RemoteBts):
+ def __init__(self, cnf):
+ bugre =3D r'^%(uri)s/issues/([0-9]+)$'
+ urifmt =3D '%(uri)s/issues/%(id)s'
+ RemoteBts.__init__(self, cnf, bugre, urifmt, RedmineData)
+
+ def isClosing(self, status, resolution):
+ return status in ('Closed',)
+
+ def isWontfix(self, status, resolution):
+ return status in ('Rejected',)
+
+RemoteBts.register('redmine', RemoteRedmine)
--=20
1.6.5
--Dxnq1zWXvFF0Q93v
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0002-Add-reductivelabs-redmine-for-Puppet.patch"
More information about the Bts-link-devel
mailing list