Merge lp:~jelmer/bzr-gtk/remove-bzr-notify into lp:bzr-gtk

Proposed by Jelmer Vernooij
Status: Merged
Merged at revision: 794
Proposed branch: lp:~jelmer/bzr-gtk/remove-bzr-notify
Merge into: lp:bzr-gtk
Diff against target: 462 lines (+9/-377)
9 files modified
NEWS (+6/-0)
bzr-notify (+0/-102)
bzr-notify.desktop (+0/-12)
bzr-notify.desktop.in (+0/-10)
notify.py (+0/-104)
preferences/__init__.py (+1/-3)
preferences/notifications.py (+0/-79)
setup.py (+2/-3)
tests/test_notify.py (+0/-64)
To merge this branch: bzr merge lp:~jelmer/bzr-gtk/remove-bzr-notify
Reviewer Review Type Date Requested Status
Vincent Ladeuil Disapprove
Curtis Hovey (community) code Approve
Review via email: mp+113990@code.launchpad.net

Description of the change

Stop shipping bzr-notify.

bzr-notify never really reached its potential - it was meant to notify about background bzr jobs, and commits that happened on the local lan (integrated with bzr-avahi).

There are several open bugs about bzr-notify and it's causing far more harm than good at the moment. Nobody has actively done anything to improve bzr-notify in a long time, so I think we should just remove it.

To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

I think this is the right decision. Thank you.

review: Approve (code)
Revision history for this message
Vincent Ladeuil (vila) wrote :

Hold on, I'm still using that, can't we just disable it by default instead (with instructions on how to enable it ;)

review: Disapprove
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

> Hold on, I'm still using that, can't we just disable it by default instead
> (with instructions on how to enable it ;)
Do we really want to keep something around that's mostly broken though? I wouldn't want any new users picking it up, especially given it's fair number of issues. It's just an extra maintenance burden.

Revision history for this message
Vincent Ladeuil (vila) wrote :

'mostly broken' seems slightly excessive given that it just works here.

I have never been able to reproduce bug #949798 myself (I witnessed it once or twice but it was long ago).

Revision history for this message
Curtis Hovey (sinzui) wrote :

Removing this feature will also fix these Ubuntu package bugs:
    Bug #919886, Bug #315741, Bug #1001679, Bugs Bug #983830, Bug #925933
and these additional bzr-gtk bugs:
    Bug #159113, Bug #107169,

I think bzr-notify is too brittle. It does not "just work". This could be a separate project and the bugs can be moved to it. Users who want the feature can install it instead of getting errors for a feature they have not asked for.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Maybe 'mostly broken' is an exaggeration, but it's far from stable and it causes a fair few problems. Given we don't really have the resources to address those issues, do we really want to keep shipping something that has this many problems, and so little real use?

lp:~jelmer/bzr-gtk/remove-bzr-notify updated
795. By Jelmer Vernooij

Remove tests and preferences page.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'NEWS'
--- NEWS 2012-03-23 15:02:38 +0000
+++ NEWS 2012-07-10 08:40:24 +0000
@@ -13,6 +13,12 @@
1313
14 * Fix searching in tree views. (Jelmer Vernooij, #928301)14 * Fix searching in tree views. (Jelmer Vernooij, #928301)
1515
16 CHANGES
17
18 * bzr-notify has been removed, as it was causing regressions
19 on several machines and not particularly useful.
20 (Jelmer Vernooij, #714767, #949798, #998994, #342135, #342136, #394536)
21
160.103.0 2011-12-11220.103.0 2011-12-11
1723
18 FEATURES24 FEATURES
1925
=== removed file 'bzr-notify'
--- bzr-notify 2012-02-03 19:49:55 +0000
+++ bzr-notify 1970-01-01 00:00:00 +0000
@@ -1,102 +0,0 @@
1#!/usr/bin/env python
2
3"""Run the bzr tray icon.
4
5This is a background program which will pop up a notification on the users
6screen when a commit occurs.
7"""
8
9from bzrlib.plugin import load_plugins
10load_plugins()
11
12from bzrlib.plugins.gtk.commands import open_display
13
14from bzrlib.plugins.gtk.notify import NotifyPopupMenu
15Gtk = open_display()
16
17import cgi
18import sys
19
20import dbus
21import dbus.service
22from gi.repository import GObject
23from gi.repository import Notify
24
25from bzrlib.bzrdir import BzrDir
26from bzrlib.osutils import format_date
27from bzrlib.transport import get_transport
28
29menu = NotifyPopupMenu()
30try:
31 from gi.repository import AppIndicator3
32except ImportError:
33 icon = Gtk.StatusIcon.new_from_icon_name("bzr-panel")
34 icon.connect('popup-menu', menu.display)
35 icon.set_visible(False)
36 hide_icon = lambda: icon.set_visible(False)
37 show_icon = lambda: icon.set_visible(True)
38else:
39 indicator = AppIndicator3.Indicator.new(
40 "bzr-gtk-notify", "bzr-panel", AppIndicator3.IndicatorCategory.OTHER)
41 indicator.set_status (AppIndicator3.IndicatorStatus.PASSIVE)
42 indicator.set_attention_icon("bzr-panel")
43 indicator.set_menu(menu)
44 hide_icon = lambda: indicator.set_status (
45 AppIndicator3.IndicatorStatus.PASSIVE)
46 show_icon = lambda: indicator.set_status (
47 AppIndicator3.IndicatorStatus.ATTENTION)
48
49if getattr(dbus, 'version', (0,0,0)) >= (0,41,0):
50 import dbus.glib
51BROADCAST_INTERFACE = "org.bazaarvcs.plugins.dbus.Broadcast"
52bus = dbus.SessionBus()
53
54def catch_branch(revision_id, urls):
55 # TODO: show all the urls, or perhaps choose the 'best'.
56 url = urls[0]
57 try:
58 if isinstance(revision_id, unicode):
59 revision_id = revision_id.encode('utf8')
60 transport = get_transport(url)
61 a_dir = BzrDir.open_from_transport(transport)
62 branch = a_dir.open_branch()
63 revno = branch.revision_id_to_revno(revision_id)
64 revision = branch.repository.get_revision(revision_id)
65 summary = 'New revision %d in %s' % (revno, url)
66 body = 'Committer: %s\n' % revision.committer
67 body += 'Date: %s\n' % format_date(revision.timestamp,
68 revision.timezone)
69 body += '\n'
70 body += revision.message
71 body = cgi.escape(body)
72 nw = Notify.Notification.new(summary, body, None)
73 def start_viz(notification=None, action=None, data=None):
74 """Start the viz program."""
75 from bzrlib.plugins.gtk.commands import start_viz_window
76 pp = start_viz_window(branch, revision_id)
77 pp.show()
78 def start_branch(notification=None, action=None, data=None):
79 """Start a Branch dialog"""
80 from bzrlib.plugins.gtk.branch import BranchDialog
81 bd = BranchDialog(remote_path=url)
82 bd.run()
83 if "actions" in Notify.get_server_caps():
84 nw.add_action("inspect", "Inspect", start_viz, None)
85 nw.add_action("branch", "Branch", start_branch, None)
86 show_icon()
87 GObject.timeout_add(5000, hide_icon)
88 nw.set_timeout(5000)
89 nw.show()
90 except Exception, e:
91 print e
92 raise
93bus.add_signal_receiver(catch_branch,
94 dbus_interface=BROADCAST_INTERFACE,
95 signal_name="Revision")
96Notify.init("bzr-notify")
97
98if sys.argv[-1] == 'test':
99 # Exit before main loop.
100 sys.exit(0)
101
102Gtk.main()
1030
=== removed file 'bzr-notify.desktop'
--- bzr-notify.desktop 2011-09-28 07:45:39 +0000
+++ bzr-notify.desktop 1970-01-01 00:00:00 +0000
@@ -1,12 +0,0 @@
1[Desktop Entry]
2Type=Application
3Version=0.1
4Name=Bazaar Notification
5GenericName=Bazaar Notification
6Comment=Notification Area Icon for Bazaar
7Icon=bzr-icon-64
8Exec=bzr-notify
9Categories=Application;Development;RevisionControl;
10Terminal=false
11X-GNOME-Autostart-Delay=30
12
130
=== removed file 'bzr-notify.desktop.in'
--- bzr-notify.desktop.in 2010-08-21 09:32:13 +0000
+++ bzr-notify.desktop.in 1970-01-01 00:00:00 +0000
@@ -1,10 +0,0 @@
1[Desktop Entry]
2Type=Application
3Version=0.1
4_Name=Bazaar Notification
5_GenericName=Bazaar Notification
6_Comment=Notification Area Icon for Bazaar
7Icon=bzr-icon-64
8Exec=bzr-notify
9Categories=Application;Development;RevisionControl;
10Terminal=false
110
=== removed file 'notify.py'
--- notify.py 2012-02-03 18:59:38 +0000
+++ notify.py 1970-01-01 00:00:00 +0000
@@ -1,104 +0,0 @@
1# Copyright (C) 2007 by Robert Collins
2# Jelmer Vernooij
3#
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 2 of the License, or
7# (at your option) any later version.
8
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17"""Notification area icon and notification for Bazaar."""
18
19from gi.repository import Gtk
20import bzrlib
21
22
23def has_dbus():
24 return (getattr(bzrlib.plugins, "dbus", None) is not None)
25
26
27def has_avahi():
28 return (getattr(bzrlib.plugins, "avahi", None) is not None)
29
30
31class NotifyPopupMenu(Gtk.Menu):
32
33 SHOW_WIDGETS = True
34
35 def __init__(self):
36 super(NotifyPopupMenu, self).__init__()
37 self.create_items()
38
39 def create_items(self):
40 from bzrlib import errors
41 item = Gtk.CheckMenuItem.new_with_mnemonic('_Gateway to LAN')
42 item.connect('toggled', self.toggle_lan_gateway)
43 self.append(item)
44 self.append(Gtk.SeparatorMenuItem())
45 try:
46 from bzrlib.plugins.dbus.activity import LanGateway
47 self.langateway = LanGateway()
48 except ImportError:
49 item.set_sensitive(False)
50 except errors.BzrError:
51 # FIXME: Should only catch errors that indicate a lan-notify
52 # process is already running.
53 item.set_sensitive(False)
54
55 item = Gtk.CheckMenuItem.new_with_mnemonic(
56 'Announce _branches on LAN')
57 item.connect('toggled', self.toggle_announce_branches)
58 self.append(item)
59 self.append(Gtk.SeparatorMenuItem())
60 try:
61 from bzrlib.plugins.avahi.share import ZeroConfServer
62 from bzrlib import urlutils
63 self.zeroconfserver = ZeroConfServer(urlutils.normalize_url('.'))
64 except ImportError:
65 item.set_sensitive(False)
66
67 item = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_PREFERENCES, None)
68 item.connect('activate', self.show_preferences)
69 self.append(item)
70 item = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_ABOUT, None)
71 item.connect('activate', self.show_about)
72 self.append(item)
73 self.append(Gtk.SeparatorMenuItem())
74 item = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_QUIT, None)
75 item.connect('activate', Gtk.main_quit)
76 self.append(item)
77 if self.SHOW_WIDGETS:
78 self.show_all()
79
80 def display(self, icon, event_button, event_time):
81 self.popup(None, None, Gtk.status_icon_position_menu,
82 event_button, event_time, icon)
83
84 def toggle_lan_gateway(self, item):
85 if item.get_active():
86 self.langateway.start()
87 else:
88 self.langateway.stop()
89
90 def toggle_announce_branches(self, item):
91 if item.get_active():
92 self.zeroconfserver.start()
93 else:
94 self.zeroconfserver.close()
95
96 def show_about(self, item):
97 from bzrlib.plugins.gtk.about import AboutDialog
98 dialog = AboutDialog()
99 dialog.run()
100
101 def show_preferences(self, item):
102 from bzrlib.plugins.gtk.preferences import PreferencesWindow
103 prefs = PreferencesWindow()
104 prefs.run()
1050
=== modified file 'preferences/__init__.py'
--- preferences/__init__.py 2011-09-07 16:01:14 +0000
+++ preferences/__init__.py 2012-07-10 08:40:24 +0000
@@ -19,7 +19,6 @@
19from bzrlib.config import GlobalConfig19from bzrlib.config import GlobalConfig
20from bzrlib.plugins.gtk.preferences.identity import IdentityPage20from bzrlib.plugins.gtk.preferences.identity import IdentityPage
21from bzrlib.plugins.gtk.preferences.plugins import PluginsPage21from bzrlib.plugins.gtk.preferences.plugins import PluginsPage
22from bzrlib.plugins.gtk.preferences.notifications import NotificationsPage
2322
24class PreferencesWindow(Gtk.Dialog):23class PreferencesWindow(Gtk.Dialog):
25 """Displays global preferences windows."""24 """Displays global preferences windows."""
@@ -55,8 +54,7 @@
5554
56 def _create_pages(self):55 def _create_pages(self):
57 return [("Identity", IdentityPage(self.config)),56 return [("Identity", IdentityPage(self.config)),
58 ("Plugins", PluginsPage()),57 ("Plugins", PluginsPage())]
59 ("Notifications", NotificationsPage(self.config))]
6058
61 def display(self):59 def display(self):
62 self.window.show_all()60 self.window.show_all()
6361
=== removed file 'preferences/notifications.py'
--- preferences/notifications.py 2011-09-05 03:44:26 +0000
+++ preferences/notifications.py 1970-01-01 00:00:00 +0000
@@ -1,79 +0,0 @@
1# Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org>
2#
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 2 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program; if not, write to the Free Software
15# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
17from gi.repository import Gtk
18
19import bzrlib.plugins.gtk
20from bzrlib.plugins.gtk.notify import (
21 has_avahi,
22 has_dbus,
23 )
24
25
26def has_email():
27 return (getattr(bzrlib.plugins, "email", None) is not None)
28
29def has_cia():
30 return (getattr(bzrlib.plugins, "cia", None) is not None)
31
32
33class NotificationsPage(Gtk.VBox):
34
35 def __init__(self, config, homogeneous=False, spacing=6):
36 self.config = config
37 super(NotificationsPage, self).__init__(
38 homogeneous=homogeneous, spacing=spacing)
39 self.set_spacing(spacing) # The vertical one
40
41 lan_frame = Gtk.Frame(label="LAN Notifications")
42
43 lan_vbox = Gtk.VBox()
44 lan_frame.add(lan_vbox)
45
46 self.gateway_to_lan = Gtk.CheckButton("_Gateway to LAN")
47 lan_vbox.pack_start(self.gateway_to_lan, False, False, 0)
48 self.gateway_to_lan.set_sensitive(has_dbus())
49
50 self.announce_on_lan = Gtk.CheckButton("_Announce on LAN")
51 lan_vbox.pack_start(self.announce_on_lan, False, False, 0)
52 self.announce_on_lan.set_sensitive(has_avahi())
53
54 self.pack_start(lan_frame, False, False, 0)
55
56 email_frame = Gtk.Frame(label="E-mail notifications")
57
58 email_hbox = Gtk.HBox()
59 self.send_email = Gtk.CheckButton("Send _E-Mail to")
60 email_hbox.pack_start(self.send_email, False, False, 0)
61 self.send_email_to = Gtk.Entry()
62 email_hbox.pack_start(self.send_email_to, False, False, 0)
63
64 email_frame.add(email_hbox)
65 email_frame.set_sensitive(has_email())
66
67 self.pack_start(email_frame, False, False, 0)
68
69 cia_frame = Gtk.Frame(label="CIA notifications")
70
71 cia_user_hbox = Gtk.HBox()
72 cia_user_hbox.pack_start(Gtk.Label("Author name"), False, False, 0)
73 self.cia_user = Gtk.Entry()
74 cia_user_hbox.pack_start(self.cia_user, False, False, 0)
75
76 cia_frame.add(cia_user_hbox)
77 cia_frame.set_sensitive(has_cia())
78
79 self.pack_start(cia_frame, False, False, 0)
800
=== modified file 'setup.py'
--- setup.py 2012-02-28 17:45:56 +0000
+++ setup.py 2012-07-10 08:40:24 +0000
@@ -148,7 +148,7 @@
148 maintainer_email="jelmer@samba.org",148 maintainer_email="jelmer@samba.org",
149 description="GTK+ Frontends for various Bazaar commands",149 description="GTK+ Frontends for various Bazaar commands",
150 license="GNU GPL v2 or later",150 license="GNU GPL v2 or later",
151 scripts=['bzr-handle-patch', 'bzr-notify'],151 scripts=['bzr-handle-patch'],
152 url="http://bazaar-vcs.org/BzrGtk",152 url="http://bazaar-vcs.org/BzrGtk",
153 package_dir={153 package_dir={
154 "bzrlib.plugins.gtk": ".",154 "bzrlib.plugins.gtk": ".",
@@ -188,8 +188,7 @@
188 # In case Python distutils extra is not available,188 # In case Python distutils extra is not available,
189 # install the .desktop files189 # install the .desktop files
190 ('share/applications', ['bazaar-properties.desktop',190 ('share/applications', ['bazaar-properties.desktop',
191 'bzr-handle-patch.desktop',191 'bzr-handle-patch.desktop']),
192 'bzr-notify.desktop']),
193 ('share/application-registry', ['bzr-gtk.applications']),192 ('share/application-registry', ['bzr-gtk.applications']),
194 ('share/pixmaps', ['icons/bzr-icon-64.png']),193 ('share/pixmaps', ['icons/bzr-icon-64.png']),
195 ('share/icons/hicolor/scalable/apps',194 ('share/icons/hicolor/scalable/apps',
196195
=== removed file 'tests/test_notify.py'
--- tests/test_notify.py 2012-02-19 15:00:34 +0000
+++ tests/test_notify.py 1970-01-01 00:00:00 +0000
@@ -1,64 +0,0 @@
1# -*- coding: utf-8 -*-
2# Copyright (C) 2012 Curtis C. Hovey <sinzui.is@verizon.net>
3#
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 2 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18import os
19import subprocess
20
21from bzrlib import tests
22from bzrlib.plugins.gtk.notify import NotifyPopupMenu
23
24
25class FakeNotifyPopupMenu(NotifyPopupMenu):
26
27 SHOW_WIDGETS = False
28
29
30class NotifyPopupMenuTestCase(tests.TestCase):
31
32 def test_init(self):
33 menu = FakeNotifyPopupMenu()
34 items = menu.get_children()
35 self.assertEqual(8, len(items))
36 self.assertEqual('_Gateway to LAN', items[0].props.label)
37 self.assertEqual('Announce _branches on LAN', items[2].props.label)
38 self.assertEqual('gtk-preferences', items[4].props.label)
39 self.assertEqual('gtk-about', items[5].props.label)
40 self.assertEqual('gtk-quit', items[7].props.label)
41
42
43class BzrNotifyTestCase(tests.TestCase):
44
45 def setUp(self):
46 top = os.path.abspath(os.path.join(
47 os.path.dirname(__file__), os.pardir))
48 self.script = os.path.join(top, 'bzr-notify')
49 self.env = dict(os.environ)
50 self.env['BZR_PLUGINS_AT'] = 'gtk@%s' % top
51 super(BzrNotifyTestCase, self).setUp()
52
53 def test_smoketest(self):
54 # This is a smoke test to verify the process starts.
55 # The logic of the module must be moved into notify.py
56 # where it can be properly tested.
57 bzr_notify = subprocess.Popen(
58 [self.script, 'test'],
59 stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=self.env)
60 stdout, stderr = bzr_notify.communicate()
61 self.assertEqual('', stdout)
62 self.assertTrue(
63 stderr in (
64 '', 'ERROR:root:Could not find any typelib for AppIndicator3\n'))

Subscribers

People subscribed via source and target branches

to all changes: