Commit Graph

92 Commits

Author SHA1 Message Date
Gregory Szorc
5380dea2a7 global: mass rewrite to use modern exception syntax
Python 2.6 introduced the "except type as instance" syntax, replacing
the "except type, instance" syntax that came before. Python 3 dropped
support for the latter syntax. Since we no longer support Python 2.4 or
2.5, we have no need to continue supporting the "except type, instance".

This patch mass rewrites the exception syntax to be Python 2.6+ and
Python 3 compatible.

This patch was produced by running `2to3 -f except -w -n .`.
2015-06-23 22:20:08 -07:00
Augie Fackler
f95a6caba1 extensions: document that testedwith = 'internal' is special
Extension authors (notably at companies using hg) have been
cargo-culting the `testedwith = 'internal'` bit from hg's own
extensions, which then defeats our "file bugs over here" logic in
dispatch. Let's be more aggressive about trying to give extension
authors a hint about what testedwith should say.
2015-04-28 16:44:37 -04:00
Yuya Nishihara
71c4aa007f templater: remove noop calls of parsestring(s, quoted=False) (API)
Since e926f2ef639a, parsestring(s, quoted=False) just returns s.
2015-05-04 10:01:03 +09:00
Jim Hague
15bbbb3991 bugzilla: stop trying to cache setup across hook invocation
In the context of standalone Hg receiving a set of incoming changes, it makes
sense for the Bugzilla module to cache basic setup to avoid reconnecting
to Bugzilla for each change. After processing the changes, Hg will exit
and so the connection is short-lived.

But this doesn't work too well when used from a long-lived environment
such as hgweb or Kallithea where, for example, the connection can time out.
So take the simple approach, abandon the cache and do the basic setup on
each call. This fixes current problems with Kallithea.
2014-07-03 10:48:37 +01:00
Jim Hague
a8d33ec9dd bugzilla: correct config documentation error
The config documentation specifies the wrong access method in the XMLRPC+email
configuration.
2014-07-03 10:56:03 +01:00
Jim Hague
14c4476395 bugzilla: support Bugzilla 4.4.3+ API login token authentication (issue4257)
Bugzilla 4.4.3 and later remove the old cookie based session authentication
from the Web Services API and replace it with a login token. The session
can now also be restricted to the originating IP.

Add the necessary to the extension so it works with 4.4.3 and later.
2014-05-23 17:29:04 +01:00
Augie Fackler
98c42c8081 bugzilla: move from dict() construction to {} literals
The latter are both faster and more consistent across Python 2 and 3.
2014-03-12 13:13:10 -04:00
Matt Mackall
694de7920e changeset_templater: remove use_template method 2014-03-08 16:14:08 -06:00
Bryan O'Sullivan
dc9ede17dc Merge spelling fixes 2012-09-11 08:36:09 -07:00
timeless@mozdev.org
49f2d80b82 en-us: recognized 2012-08-17 13:58:19 -07:00
Mads Kiilerich
2f4504e446 fix trivial spelling errors 2012-08-15 22:38:42 +02:00
Matt Mackall
cb4824284b merge with stable 2012-06-06 21:17:33 -05:00
Jim Hague
1b46810a77 bugzilla: stop bugs always being marked as fixed in xmlrpc (issue3484)
Bugs should only be marked fixed if the comment parser gives them the
fixed state. xmlrpc+email got this right, xmlrpc screwed it up.
2012-06-06 16:44:17 +01:00
Augie Fackler
96d44b39f7 hgext: mark all first-party extensions as such 2012-05-15 14:37:49 -05:00
Brodie Rao
d6a6abf2b0 cleanup: eradicate long lines 2012-05-12 15:54:54 +02:00
Steven Stallion
66e5651b6d bugzilla: fix transport initialization on python 2.4 2012-05-11 22:48:19 -07:00
Matt Mackall
4a144a5db5 merge with stable 2012-03-04 16:48:04 -06:00
Jim Hague
cad5cac971 bugzilla: add xmlrpcemail submission for Bugzilla 3.6 email interface
Some of the formatting details required for bug submission via email
changed between Bugzilla 3.4 and 3.6. Bugzilla 3.4 requires lines of
the form '@fieldname = value', while 3.6 wants '@fieldname value'.
Also the field @bug_id in 3.4 becomes @id in 3.6.

Bugzilla up to and including 4.0 also recognises the 3.4 format. To save
surprises in the future, check the Bugzilla version and use the 3.6
format from all major versions >= 4. At some point we will
drop support for Bugzilla prior to 3.6 and support the new format only.
2012-03-01 14:50:31 +00:00
Jim Hague
ef9d8e60cc bugzilla: allow change comment to mark bugs fixed
Add a second regular expression used when scanning change comments.
Bugs matched by this new regular expression have the bug comments and
optionally hours updated as with the first regular expression, but they
are also marked as fixed.

The bug status and resolution to set to mark a bug as fixed can be
configured. By default status is set to RESOLVED and resolution to
FIXED, the default Bugzilla settings.

For example, a change comment containing 'Fixes 1234 h1.5' will be
added to bug 1234, the bug will have its working time increased by
1.65 hours, and the bug will be marked RESOLVED/FIXED.

Change comments may contain both bug update and fix instructions. If
the same bug ID occurs in both, the last instruction found takes
precedence.

The patch adds new bug states 'bug_status' and 'resolution' and actions
to update them to the XMLRPC and XMLRPC/email access methods. XMLRPC does
not support marking bugs as fixed when used with Bugzilla versions prior
to 4.0. When used with an earlier Bugzilla version, a warning is issued
and only comment and hours updated.
2012-03-01 15:27:24 +00:00
Jim Hague
6c5c699aef bugzilla: extract optional hours from commit message and update bug time
If an 'hours' group is present in the bug matching regular expression,
and that group contains a float value, update the bug working time in
Bugzilla with those hours.

The patch adds a key 'hours' to the bug state dictionary, and adds
support for the key to the XMLRPC and XMLRPC/email access methods.
The MySQL access method is not supported; a warning is given.
2012-03-01 15:25:37 +00:00
Jim Hague
df2c50f6f8 bugzilla: modify access interface to include new bug states
As a first step to allowing comment text to update bug state, rework the
Bugzilla access interface to use a dictionary keyed on bug ID. Dictionary
entries will contain new state info in future changes.
2012-03-01 14:51:40 +00:00
Jim Hague
d51f75e5f8 bugzilla: correct comment typo 2012-03-01 14:42:23 +00:00
Jim Hague
dae7a893f8 bugzilla: stop XMLRPC requests from requesting gzipped responses
Python 2.7 introduced support for gzip encoding in xmlrpclib.Transport.
We do our own handling of responses, and don't currently support gzip encoding.
So to run successfully under Python 2.7 with a web server configured
to gzip encode, stop XMLRPC requests from announcing gzip encoding support.
2012-02-29 17:43:03 +00:00
Jim Hague
627ffc395e bugzilla: make XMLRPC interface support http and https access
Inadvertently support is currently only for https. For some reason I
thought xmlrpclib.SafeTransport did http and https, but it is https only.

So create http and https XMLRPC transports that retain cookies. Decide which
to use by inspecting the Bugzilla URL.
2012-01-11 16:54:29 +00:00
Wagner Bruna
e9d8028876 bugzilla: fix typo in documentation 2011-06-14 20:08:35 -03:00
Adrian Buehlmann
e94d06bb79 rename explain_exit to explainexit 2011-05-06 15:31:09 +02:00
Jim Hague
80a125d068 bugzilla: more documentation formatting fixups
Correct typo in numbering list of access methods.
Convert a section reference and a template parameter reference into
literal text, for consistency with other use.
2011-04-06 11:30:08 +01:00
Martin Geisler
9dfcd73e5b bugzilla: convert a verbatim block to a field list 2011-04-05 10:22:58 +02:00
Martin Geisler
3d9f5b0e1f bugzilla: fix reST error introduced in a2e32837d8f5
All blocks must be indented. Here we can use a field list instead of a
verbatim block for a real list layout.
2011-04-05 10:20:59 +02:00
Jim Hague
65534172e2 bugzilla: more documentation fixes
Correct formatting of the possible values of bugzilla.version.
Fix typo and polish XMLRPC/email mode description.
2011-04-04 17:37:18 +01:00
Jim Hague
3be6a4e3fe bugzilla: correct sample configurations
Use consistent sample domains and wording in all configuration examples.

Add missing template and strip parameters to XMLRPC examples and correct
Bugzilla URL key in XMLRPC+email.
2011-04-04 13:31:37 +01:00
Patrick Mezard
964b307b71 bugzilla: fix documentation typo 2011-04-01 20:40:27 +02:00
Martin Geisler
d8a6341a37 bugzilla: fix bad reST markup
The indented second line turned the first line into a description
header.
2011-04-01 12:30:40 +02:00
Martin Geisler
8cb176c788 bugzilla: markup literal text as such 2011-04-01 12:27:12 +02:00
Martin Geisler
0d1109205c bugzilla: refer to hgrc(5) man page with normal notation 2011-04-01 12:09:11 +02:00
Martin Geisler
459fedb4ee bugzilla: markup section names as literal text 2011-04-01 12:07:37 +02:00
Martin Geisler
f9635687a7 bugzilla: show usermap syntax more clearly 2011-04-01 12:05:19 +02:00
Martin Geisler
c285f18e77 bugzilla: use standard section.name notation 2011-04-01 12:03:23 +02:00
Martin Geisler
36682a123f bugzilla: prefix each config option with section 2011-04-01 12:00:57 +02:00
Martin Geisler
584b9eaf34 bugzilla: fix reStructuredText errors introduced in 4e52d7534ab2 2011-04-01 11:59:18 +02:00
Jim Hague
aee30b7a2e bugzilla: add modified XMLRPC mode that uses email to send bug comments.
If Bugzilla has its email interface configured, an email can be used
to update bugs. If the From: address in the email matches a valid user
email, Bugzillas make the update as that user. So comments attached to a
bug appear under the name of the user making the change, and the user
does not receive email about the change, exactly as if they had made
the change via the web interface.

So add a modified XMLRPC mode that uses email to modify bugs. The format
of the mails is documented in the Bugzilla email_in.pl specification.
Briefly, initial non-blank lines in the message body starting
'@<field> = <value> modify bug fields. A blank line signals the end of
the command lines, and the rest of the message is used as bug comment.

Invoke the same Mercurial user to Bugzilla user email mapping
currently used in the MySQL mode.

All other processing - checking the bug numbers, checking user ids, etc.
continues to be done via XMLRPC.
2011-03-30 09:49:45 +01:00
Jim Hague
50d39b606d bugzilla: add XMLRPC interface.
Add support for access to Bugzilla via the XMLRPC interface.

This requires a single username and password used to log in to Bugzilla,
plus the URL of the Bugzilla installation. Commit messages are added to
bugs as before, but security only permits them to be added as the
username used to log in.
2011-03-30 09:49:45 +01:00
Jim Hague
86c71c3e2f bugzilla: localise all MySQL direct access inside access class.
Prepare for the addition of other Bugzilla access methods by localising
direct MySQL database access inside an access class.

Provide a base access class largely to document the methods required for
a class implementing a particular access method.

Rename the 'bugzilla_<version>' classes to 'bzmysql_<version>' to
emphasise that they are doing access via direct manipulation of a
MySQL database.
2011-03-30 09:49:45 +01:00
Jim Hague
2813d6b869 bugzilla: keep bug IDs in set.
Bug IDs are collected into a set, and then silently converted in
filter_real_bug_ids() into a list. For consistency, keep them in
a set throughout and update the docstrings to say that.
2011-03-30 09:49:45 +01:00
Jim Hague
e369f66c45 bugzilla: rename filter_unknown_bug_ids to reflect its actual purpose.
The method really removes from the list of bugs any that already have
comment text referencing the changeset in question. Rename it to
filter_cset_known_bug_ids().
2011-03-30 09:49:45 +01:00
Renato Cunha
b6d6b8775c removed exception args indexing (not supported by py3k)
Py3k removed __getitem__ for exception classes. The correct way of
getting the exception arguments is by using the args method.
2010-07-14 23:03:21 -03:00
Dirkjan Ochtman
1a3040f895 bugzilla: revert unhelpful check-code changes, module is actually called MySQLdb 2010-02-15 09:57:11 +01:00
Matt Mackall
e8e49c5f78 bugzilla: lowercase mysqldb var 2010-01-28 22:45:04 -06:00
Matt Mackall
8d99be19f0 many, many trivial check-code fixups 2010-01-25 00:05:27 -06:00
Matt Mackall
595d66f424 Update license to GPLv2+ 2010-01-19 22:20:08 -06:00