--- a/.hgignore
+++ b/.hgignore
@@ -2,17 +2,16 @@ coverage/
docs/_build/
hghooks/Mozilla_Hg_Hooks.egg-info/
pylib/mozansible/mozansible.egg-info/
pylib/mozautomation/mozautomation.egg-info/
pylib/mozhginfo/mozhginfo.egg-info/
pylib/mozhginfo/pushlog_client.egg-info
pylib/mozreview/mozreview.egg-info/
pylib/mozreviewbots/mozreviewbots.egg-info/
-pylib/rbbz/rbbz.egg-info/
pylib/Bugsy/bugsy.egg-info/
pylib/vcsreplicator/vcsreplicator.egg-info/
testing/bmoserver/.vagrant
testing/puppet/files/Mozilla-Bugzilla-Public*
testing/unifiedserver/.vagrant
testing/vcttesting.egg-info/
venv/
\.pyc$
--- a/ansible/roles/docker-rbweb/files/install-reviewboard
+++ b/ansible/roles/docker-rbweb/files/install-reviewboard
@@ -54,23 +54,20 @@ initialize()
# have undesirable consequences.
#
# TODO this appears to add ~1s overhead. Consider putting this behavior
# behind a flag.
print('disabling extensions')
site.run_manage_command('disable-extension',
['mozreview.extension.MozReviewExtension'])
site.run_manage_command('disable-extension',
- ['rbbz.extension.BugzillaExtension'])
-site.run_manage_command('disable-extension',
['rbmotd.extension.MotdExtension'])
print('enabling extensions')
site.run_manage_command('enable-extension', ['mozreview.extension.MozReviewExtension'])
-site.run_manage_command('enable-extension', ['rbbz.extension.BugzillaExtension'])
site.run_manage_command('enable-extension', ['rbmotd.extension.MotdExtension'])
# Hook up Bugzilla authentication.
site.run_manage_command('set-siteconfig', ['--key=auth_backend',
'--value=bugzilla'])
site.run_manage_command('set-siteconfig', ['--key=logging_enabled',
--- a/ansible/roles/docker-rbweb/tasks/main.yml
+++ b/ansible/roles/docker-rbweb/tasks/main.yml
@@ -28,25 +28,23 @@
- name: Install mozreview extension
shell: /venv/bin/easy_install -U dist/*.egg chdir=/version-control-tools/pylib/mozreview
tags:
- docker-refresh
- name: Build other extension
command: /venv/bin/python setup.py bdist_egg chdir=/version-control-tools/pylib/{{ item }}
with_items:
- - rbbz
- rbmotd
tags:
- docker-refresh
- name: Install other extensions
shell: /venv/bin/easy_install -U dist/*.egg chdir=/version-control-tools/pylib/{{ item }}
with_items:
- - rbbz
- rbmotd
tags:
- docker-refresh
- name: Remove default httpd configs
file: path={{ item }} state=absent
with_items:
- /etc/httpd/conf.d/welcome.conf
--- a/ansible/tasks/install-mozreview.yml
+++ b/ansible/tasks/install-mozreview.yml
@@ -13,31 +13,22 @@
command: "{{ venv }}/bin/hg --config extensions.purge= -R {{ rb_vct }} purge --all"
# mozreview imports from mozautomation package. So, we need to install
# mozautomation before mozreview can be built.
- name: install mozautomation egg
command: "{{ venv }}/bin/pip install --upgrade --no-deps --force-reinstall {{ rb_vct }}/pylib/mozautomation"
-# rbbz imports from mozreview package. So, we need to install mozreview before
-# rbbz can be built.
-
- name: build mozreview egg
command: "{{ python }} setup.py bdist_egg chdir={{ rb_vct }}/pylib/mozreview"
- name: install mozreview egg
shell: "{{ easy_install }} -U dist/*.egg chdir={{ rb_vct }}/pylib/mozreview"
-- name: build rbbz egg
- command: "{{ python }} setup.py bdist_egg chdir={{ rb_vct }}/pylib/rbbz"
-
-- name: install rbbz egg
- shell: "{{ easy_install }} -U dist/*.egg chdir={{ rb_vct }}/pylib/rbbz"
-
- name: build rbmotd egg
command: "{{ python }} setup.py bdist_egg chdir={{ rb_vct }}/pylib/rbmotd"
- name: install rbmotd egg
shell: "{{ easy_install }} -U dist/*.egg chdir={{ rb_vct }}/pylib/rbmotd"
- name: Generate static Review Board files from extensions
command: "{{ rbsite }} manage {{ sitehome }} -- install-extension-media --force"
--- a/create-test-environment
+++ b/create-test-environment
@@ -71,20 +71,16 @@ cd ../..
cd pylib/mozreview
python setup.py develop
cd ../..
cd pylib/mozreviewbots
python setup.py develop
cd ../..
-cd pylib/rbbz
-python setup.py develop
-cd ../..
-
cd pylib/vcsreplicator
python setup.py develop
cd ../..
cd hghooks
python setup.py develop
cd ..
--- a/moz.build
+++ b/moz.build
@@ -62,15 +62,11 @@ with Files('hgtemplates/**'):
with Files('hgserver/**'):
BUG_COMPONENT = ('Developer Services', 'Mercurial: hg.mozilla.org')
FINAL = True
with Files('hgwsgi/**'):
BUG_COMPONENT = ('Developer Services', 'Mercurial: hg.mozilla.org')
FINAL = True
-with Files('pylib/rbbz/**'):
- BUG_COMPONENT = ('Developer Services', 'MozReview')
- FINAL = True
-
with Files('pylib/reviewboardmods/**'):
BUG_COMPONENT = ('Developer Services', 'MozReview')
FINAL = True
--- a/pylib/mozreview/mozreview/signal_handlers.py
+++ b/pylib/mozreview/mozreview/signal_handlers.py
@@ -1,14 +1,15 @@
from __future__ import unicode_literals
import copy
import json
import logging
+from django.contrib.sites.models import Site
from django.db.models.signals import (
post_save,
pre_delete,
)
from djblets.siteconfig.models import (
SiteConfiguration,
)
@@ -18,36 +19,40 @@ from reviewboard.reviews.errors import (
from reviewboard.extensions.hooks import (
SignalHook,
)
from reviewboard.reviews.models import (
ReviewRequest,
ReviewRequestDraft,
)
from reviewboard.reviews.signals import (
+ reply_publishing,
+ review_publishing,
review_request_closed,
review_request_publishing,
review_request_reopened,
)
from mozreview.bugzilla.attachments import (
update_bugzilla_attachments,
)
from mozreview.bugzilla.client import (
Bugzilla,
BugzillaAttachmentUpdates,
)
from mozreview.bugzilla.errors import (
BugzillaError,
bugzilla_to_publish_errors,
)
+from mozreview.diffs import build_plaintext_review
from mozreview.errors import (
CommitPublishProhibited,
ConfidentialBugError,
InvalidBugIdError,
+ ParentShipItError,
)
from mozreview.extra_data import (
DISCARD_ON_PUBLISH_KEY,
DRAFTED_COMMIT_DATA_KEYS,
fetch_commit_data,
gen_child_rrs,
gen_rrs_by_extra_data_key,
gen_rrs_by_rids,
@@ -119,16 +124,24 @@ def initialize_signal_handlers(extension
on_review_request_closed_submitted)
SignalHook(
extension,
review_request_publishing,
on_review_request_publishing,
sandbox_errors=False)
+ # Any abortable signal hooks that talk to Bugzilla should have
+ # sandbox_errors=False, since we don't want to complete the action if
+ # updating Bugzilla failed for any reason.
+ SignalHook(extension, review_publishing, on_review_publishing,
+ sandbox_errors=False)
+ SignalHook(extension, reply_publishing, on_reply_publishing,
+ sandbox_errors=False)
+
def post_save_review_request_draft(sender, **kwargs):
"""Handle post_save for a ReviewRequestDraft."""
draft = kwargs["instance"]
if kwargs["created"] and not kwargs["raw"]:
copy_commit_data(draft)
@@ -539,8 +552,89 @@ def _close_child_review_requests(user, r
commit_data=commit_data):
child.close(ReviewRequest.DISCARDED,
user=user,
description=NEVER_USED_DESCRIPTION)
commit_data.extra_data[UNPUBLISHED_KEY] = '[]'
commit_data.extra_data[DISCARD_ON_PUBLISH_KEY] = '[]'
commit_data.save(update_fields=['extra_data'])
+
+
+def get_reply_url(reply, site=None, siteconfig=None):
+ """ Get the URL for a reply to a review.
+
+ Since replies can have multiple comments, we can't link to a specific
+ comment, so we link to the parent review which the reply is targeted at.
+ """
+ return get_obj_url(reply.base_reply_to, site=site, siteconfig=siteconfig)
+
+
+@bugzilla_to_publish_errors
+def on_review_publishing(user, review, **kwargs):
+ """Comment in the bug and potentially r+ or clear a review flag.
+
+ Note that a reviewer *must* have editbugs to set an attachment flag on
+ someone else's attachment (i.e. the standard BMO review process).
+
+ TODO: Report lack-of-editbugs properly; see bug 1119065.
+ """
+ review_request = review.review_request
+ logger.info('Publishing review for user: %s review id: %s '
+ 'review request id: %s' % (user, review.id,
+ review_request.id))
+
+ # skip review requests that were not pushed
+ if not is_pushed(review_request):
+ logger.info('Did not publish review: %s: for user: %d: review not '
+ 'pushed.' % (user, review.id))
+ return
+
+ site = Site.objects.get_current()
+ siteconfig = SiteConfiguration.objects.get_current()
+ comment = build_plaintext_review(review,
+ get_obj_url(review, site,
+ siteconfig),
+ {"user": user})
+ b = Bugzilla(get_bugzilla_api_key(user))
+
+ # TODO: Update all attachments in one call. This is not possible right
+ # now because we have to potentially mix changing and creating flags.
+
+ if is_parent(review_request):
+ # Mirror the comment to the bug, unless it's a ship-it, in which
+ # case throw an error. Ship-its are allowed only on child commits.
+ if review.ship_it:
+ raise ParentShipItError
+
+ [b.post_comment(int(bug_id), comment) for bug_id in
+ review_request.get_bug_list()]
+ else:
+ diff_url = '%sdiff/#index_header' % get_obj_url(review_request)
+ bug_id = int(review_request.get_bug_list()[0])
+
+ if review.ship_it:
+ commented = b.r_plus_attachment(bug_id, review.user.email,
+ diff_url, comment)
+ else:
+ commented = b.cancel_review_request(bug_id, review.user.email,
+ diff_url, comment)
+
+ if comment and not commented:
+ b.post_comment(bug_id, comment)
+
+
+@bugzilla_to_publish_errors
+def on_reply_publishing(user, reply, **kwargs):
+ review_request = reply.review_request
+ logger.info('Posting bugzilla reply for review request %s' % (
+ review_request.id))
+
+ # skip review requests that were not pushed
+ if not is_pushed(review_request):
+ return
+
+ bug_id = int(review_request.get_bug_list()[0])
+ b = Bugzilla(get_bugzilla_api_key(user))
+
+ url = get_reply_url(reply)
+ comment = build_plaintext_review(reply, url, {"user": user})
+ b.post_comment(bug_id, comment)
deleted file mode 100644
--- a/pylib/rbbz/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-*.pyc
-*~
-build
-dist
-rbbz.egg-info
deleted file mode 100644
--- a/pylib/rbbz/MANIFEST.in
+++ /dev/null
@@ -1,1 +0,0 @@
-include README.md
deleted file mode 100644
--- a/pylib/rbbz/rbbz/extension.py
+++ /dev/null
@@ -1,131 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-import logging
-
-from django.contrib.sites.models import Site
-
-from djblets.siteconfig.models import SiteConfiguration
-
-from reviewboard.extensions.base import Extension
-from reviewboard.extensions.hooks import SignalHook
-from reviewboard.reviews.signals import (
- reply_publishing,
- review_publishing,
-)
-
-from mozreview.bugzilla.client import Bugzilla
-from mozreview.bugzilla.errors import (
- bugzilla_to_publish_errors,
-)
-from mozreview.diffs import build_plaintext_review
-from mozreview.errors import (
- ParentShipItError,
-)
-from mozreview.extra_data import (
- is_parent,
- is_pushed,
-)
-from mozreview.middleware import CorsHeaderMiddleware
-from mozreview.models import (
- get_bugzilla_api_key,
-)
-from mozreview.rb_utils import (
- get_obj_url,
-)
-
-logger = logging.getLogger(__name__)
-
-
-class BugzillaExtension(Extension):
-
- def initialize(self):
- # Any abortable signal hooks that talk to Bugzilla should have
- # sandbox_errors=False, since we don't want to complete the action if
- # updating Bugzilla failed for any reason.
- SignalHook(self, review_publishing, on_review_publishing,
- sandbox_errors=False)
- SignalHook(self, reply_publishing, on_reply_publishing,
- sandbox_errors=False)
-
-
-def get_reply_url(reply, site=None, siteconfig=None):
- """ Get the URL for a reply to a review.
-
- Since replies can have multiple comments, we can't link to a specific
- comment, so we link to the parent review which the reply is targeted at.
- """
- return get_obj_url(reply.base_reply_to, site=site, siteconfig=siteconfig)
-
-
-@bugzilla_to_publish_errors
-def on_review_publishing(user, review, **kwargs):
- """Comment in the bug and potentially r+ or clear a review flag.
-
- Note that a reviewer *must* have editbugs to set an attachment flag on
- someone else's attachment (i.e. the standard BMO review process).
-
- TODO: Report lack-of-editbugs properly; see bug 1119065.
- """
- review_request = review.review_request
- logger.info('Publishing review for user: %s review id: %s '
- 'review request id: %s' % (user, review.id,
- review_request.id))
-
- # skip review requests that were not pushed
- if not is_pushed(review_request):
- logger.info('Did not publish review: %s: for user: %d: review not '
- 'pushed.' % (user, review.id))
- return
-
- site = Site.objects.get_current()
- siteconfig = SiteConfiguration.objects.get_current()
- comment = build_plaintext_review(review,
- get_obj_url(review, site,
- siteconfig),
- {"user": user})
- b = Bugzilla(get_bugzilla_api_key(user))
-
- # TODO: Update all attachments in one call. This is not possible right
- # now because we have to potentially mix changing and creating flags.
-
- if is_parent(review_request):
- # Mirror the comment to the bug, unless it's a ship-it, in which
- # case throw an error. Ship-its are allowed only on child commits.
- if review.ship_it:
- raise ParentShipItError
-
- [b.post_comment(int(bug_id), comment) for bug_id in
- review_request.get_bug_list()]
- else:
- diff_url = '%sdiff/#index_header' % get_obj_url(review_request)
- bug_id = int(review_request.get_bug_list()[0])
-
- if review.ship_it:
- commented = b.r_plus_attachment(bug_id, review.user.email,
- diff_url, comment)
- else:
- commented = b.cancel_review_request(bug_id, review.user.email,
- diff_url, comment)
-
- if comment and not commented:
- b.post_comment(bug_id, comment)
-
-
-@bugzilla_to_publish_errors
-def on_reply_publishing(user, reply, **kwargs):
- review_request = reply.review_request
- logger.info('Posting bugzilla reply for review request %s' % (
- review_request.id))
-
- # skip review requests that were not pushed
- if not is_pushed(review_request):
- return
-
- bug_id = int(review_request.get_bug_list()[0])
- b = Bugzilla(get_bugzilla_api_key(user))
-
- url = get_reply_url(reply)
- comment = build_plaintext_review(reply, url, {"user": user})
- b.post_comment(bug_id, comment)
deleted file mode 100644
--- a/pylib/rbbz/setup.py
+++ /dev/null
@@ -1,20 +0,0 @@
-from reviewboard.extensions.packaging import setup
-
-PACKAGE = 'rbbz'
-VERSION = '0.2.9'
-
-setup(
- name=PACKAGE,
- version=VERSION,
- description='Review Board extension for Bugzilla support',
- url='https://github.com/mozilla/rbbz',
- author='Mark Cote',
- author_email='mcote@mozilla.com',
- license='MPL 2.0',
- packages=['rbbz'],
- install_requires=['mozautomation>=0.2'],
- entry_points={
- 'reviewboard.extensions':
- '%s = rbbz.extension:BugzillaExtension' % PACKAGE,
- }
-)
--- a/testing/vcttesting/mozreview.py
+++ b/testing/vcttesting/mozreview.py
@@ -394,17 +394,16 @@ class MozReview(object):
name = 'mozreview-%s' % os.path.basename(self._path)
data = json.dumps(['trigger', ROOT, {
'name': name,
'chdir': ROOT,
'expression': ['anyof',
['dirname', 'hgext/reviewboard'],
['dirname', 'pylib/mozreview'],
- ['dirname', 'pylib/rbbz'],
['dirname', 'reviewboardmods'],
],
'command': ['%s/mozreview' % ROOT, 'refresh', self._path],
}])
p = subprocess.Popen([WATCHMAN, '-j'], stdin=subprocess.PIPE)
p.communicate(data)
res = p.wait()
if res != 0: