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
1=== modified file 'NEWS'
2--- NEWS 2012-03-23 15:02:38 +0000
3+++ NEWS 2012-07-10 08:40:24 +0000
4@@ -13,6 +13,12 @@
5
6 * Fix searching in tree views. (Jelmer Vernooij, #928301)
7
8+ CHANGES
9+
10+ * bzr-notify has been removed, as it was causing regressions
11+ on several machines and not particularly useful.
12+ (Jelmer Vernooij, #714767, #949798, #998994, #342135, #342136, #394536)
13+
14 0.103.0 2011-12-11
15
16 FEATURES
17
18=== removed file 'bzr-notify'
19--- bzr-notify 2012-02-03 19:49:55 +0000
20+++ bzr-notify 1970-01-01 00:00:00 +0000
21@@ -1,102 +0,0 @@
22-#!/usr/bin/env python
23-
24-"""Run the bzr tray icon.
25-
26-This is a background program which will pop up a notification on the users
27-screen when a commit occurs.
28-"""
29-
30-from bzrlib.plugin import load_plugins
31-load_plugins()
32-
33-from bzrlib.plugins.gtk.commands import open_display
34-
35-from bzrlib.plugins.gtk.notify import NotifyPopupMenu
36-Gtk = open_display()
37-
38-import cgi
39-import sys
40-
41-import dbus
42-import dbus.service
43-from gi.repository import GObject
44-from gi.repository import Notify
45-
46-from bzrlib.bzrdir import BzrDir
47-from bzrlib.osutils import format_date
48-from bzrlib.transport import get_transport
49-
50-menu = NotifyPopupMenu()
51-try:
52- from gi.repository import AppIndicator3
53-except ImportError:
54- icon = Gtk.StatusIcon.new_from_icon_name("bzr-panel")
55- icon.connect('popup-menu', menu.display)
56- icon.set_visible(False)
57- hide_icon = lambda: icon.set_visible(False)
58- show_icon = lambda: icon.set_visible(True)
59-else:
60- indicator = AppIndicator3.Indicator.new(
61- "bzr-gtk-notify", "bzr-panel", AppIndicator3.IndicatorCategory.OTHER)
62- indicator.set_status (AppIndicator3.IndicatorStatus.PASSIVE)
63- indicator.set_attention_icon("bzr-panel")
64- indicator.set_menu(menu)
65- hide_icon = lambda: indicator.set_status (
66- AppIndicator3.IndicatorStatus.PASSIVE)
67- show_icon = lambda: indicator.set_status (
68- AppIndicator3.IndicatorStatus.ATTENTION)
69-
70-if getattr(dbus, 'version', (0,0,0)) >= (0,41,0):
71- import dbus.glib
72-BROADCAST_INTERFACE = "org.bazaarvcs.plugins.dbus.Broadcast"
73-bus = dbus.SessionBus()
74-
75-def catch_branch(revision_id, urls):
76- # TODO: show all the urls, or perhaps choose the 'best'.
77- url = urls[0]
78- try:
79- if isinstance(revision_id, unicode):
80- revision_id = revision_id.encode('utf8')
81- transport = get_transport(url)
82- a_dir = BzrDir.open_from_transport(transport)
83- branch = a_dir.open_branch()
84- revno = branch.revision_id_to_revno(revision_id)
85- revision = branch.repository.get_revision(revision_id)
86- summary = 'New revision %d in %s' % (revno, url)
87- body = 'Committer: %s\n' % revision.committer
88- body += 'Date: %s\n' % format_date(revision.timestamp,
89- revision.timezone)
90- body += '\n'
91- body += revision.message
92- body = cgi.escape(body)
93- nw = Notify.Notification.new(summary, body, None)
94- def start_viz(notification=None, action=None, data=None):
95- """Start the viz program."""
96- from bzrlib.plugins.gtk.commands import start_viz_window
97- pp = start_viz_window(branch, revision_id)
98- pp.show()
99- def start_branch(notification=None, action=None, data=None):
100- """Start a Branch dialog"""
101- from bzrlib.plugins.gtk.branch import BranchDialog
102- bd = BranchDialog(remote_path=url)
103- bd.run()
104- if "actions" in Notify.get_server_caps():
105- nw.add_action("inspect", "Inspect", start_viz, None)
106- nw.add_action("branch", "Branch", start_branch, None)
107- show_icon()
108- GObject.timeout_add(5000, hide_icon)
109- nw.set_timeout(5000)
110- nw.show()
111- except Exception, e:
112- print e
113- raise
114-bus.add_signal_receiver(catch_branch,
115- dbus_interface=BROADCAST_INTERFACE,
116- signal_name="Revision")
117-Notify.init("bzr-notify")
118-
119-if sys.argv[-1] == 'test':
120- # Exit before main loop.
121- sys.exit(0)
122-
123-Gtk.main()
124
125=== removed file 'bzr-notify.desktop'
126--- bzr-notify.desktop 2011-09-28 07:45:39 +0000
127+++ bzr-notify.desktop 1970-01-01 00:00:00 +0000
128@@ -1,12 +0,0 @@
129-[Desktop Entry]
130-Type=Application
131-Version=0.1
132-Name=Bazaar Notification
133-GenericName=Bazaar Notification
134-Comment=Notification Area Icon for Bazaar
135-Icon=bzr-icon-64
136-Exec=bzr-notify
137-Categories=Application;Development;RevisionControl;
138-Terminal=false
139-X-GNOME-Autostart-Delay=30
140-
141
142=== removed file 'bzr-notify.desktop.in'
143--- bzr-notify.desktop.in 2010-08-21 09:32:13 +0000
144+++ bzr-notify.desktop.in 1970-01-01 00:00:00 +0000
145@@ -1,10 +0,0 @@
146-[Desktop Entry]
147-Type=Application
148-Version=0.1
149-_Name=Bazaar Notification
150-_GenericName=Bazaar Notification
151-_Comment=Notification Area Icon for Bazaar
152-Icon=bzr-icon-64
153-Exec=bzr-notify
154-Categories=Application;Development;RevisionControl;
155-Terminal=false
156
157=== removed file 'notify.py'
158--- notify.py 2012-02-03 18:59:38 +0000
159+++ notify.py 1970-01-01 00:00:00 +0000
160@@ -1,104 +0,0 @@
161-# Copyright (C) 2007 by Robert Collins
162-# Jelmer Vernooij
163-#
164-# This program is free software; you can redistribute it and/or modify
165-# it under the terms of the GNU General Public License as published by
166-# the Free Software Foundation; either version 2 of the License, or
167-# (at your option) any later version.
168-
169-# This program is distributed in the hope that it will be useful,
170-# but WITHOUT ANY WARRANTY; without even the implied warranty of
171-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
172-# GNU General Public License for more details.
173-
174-# You should have received a copy of the GNU General Public License
175-# along with this program; if not, write to the Free Software
176-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
177-"""Notification area icon and notification for Bazaar."""
178-
179-from gi.repository import Gtk
180-import bzrlib
181-
182-
183-def has_dbus():
184- return (getattr(bzrlib.plugins, "dbus", None) is not None)
185-
186-
187-def has_avahi():
188- return (getattr(bzrlib.plugins, "avahi", None) is not None)
189-
190-
191-class NotifyPopupMenu(Gtk.Menu):
192-
193- SHOW_WIDGETS = True
194-
195- def __init__(self):
196- super(NotifyPopupMenu, self).__init__()
197- self.create_items()
198-
199- def create_items(self):
200- from bzrlib import errors
201- item = Gtk.CheckMenuItem.new_with_mnemonic('_Gateway to LAN')
202- item.connect('toggled', self.toggle_lan_gateway)
203- self.append(item)
204- self.append(Gtk.SeparatorMenuItem())
205- try:
206- from bzrlib.plugins.dbus.activity import LanGateway
207- self.langateway = LanGateway()
208- except ImportError:
209- item.set_sensitive(False)
210- except errors.BzrError:
211- # FIXME: Should only catch errors that indicate a lan-notify
212- # process is already running.
213- item.set_sensitive(False)
214-
215- item = Gtk.CheckMenuItem.new_with_mnemonic(
216- 'Announce _branches on LAN')
217- item.connect('toggled', self.toggle_announce_branches)
218- self.append(item)
219- self.append(Gtk.SeparatorMenuItem())
220- try:
221- from bzrlib.plugins.avahi.share import ZeroConfServer
222- from bzrlib import urlutils
223- self.zeroconfserver = ZeroConfServer(urlutils.normalize_url('.'))
224- except ImportError:
225- item.set_sensitive(False)
226-
227- item = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_PREFERENCES, None)
228- item.connect('activate', self.show_preferences)
229- self.append(item)
230- item = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_ABOUT, None)
231- item.connect('activate', self.show_about)
232- self.append(item)
233- self.append(Gtk.SeparatorMenuItem())
234- item = Gtk.ImageMenuItem.new_from_stock(Gtk.STOCK_QUIT, None)
235- item.connect('activate', Gtk.main_quit)
236- self.append(item)
237- if self.SHOW_WIDGETS:
238- self.show_all()
239-
240- def display(self, icon, event_button, event_time):
241- self.popup(None, None, Gtk.status_icon_position_menu,
242- event_button, event_time, icon)
243-
244- def toggle_lan_gateway(self, item):
245- if item.get_active():
246- self.langateway.start()
247- else:
248- self.langateway.stop()
249-
250- def toggle_announce_branches(self, item):
251- if item.get_active():
252- self.zeroconfserver.start()
253- else:
254- self.zeroconfserver.close()
255-
256- def show_about(self, item):
257- from bzrlib.plugins.gtk.about import AboutDialog
258- dialog = AboutDialog()
259- dialog.run()
260-
261- def show_preferences(self, item):
262- from bzrlib.plugins.gtk.preferences import PreferencesWindow
263- prefs = PreferencesWindow()
264- prefs.run()
265
266=== modified file 'preferences/__init__.py'
267--- preferences/__init__.py 2011-09-07 16:01:14 +0000
268+++ preferences/__init__.py 2012-07-10 08:40:24 +0000
269@@ -19,7 +19,6 @@
270 from bzrlib.config import GlobalConfig
271 from bzrlib.plugins.gtk.preferences.identity import IdentityPage
272 from bzrlib.plugins.gtk.preferences.plugins import PluginsPage
273-from bzrlib.plugins.gtk.preferences.notifications import NotificationsPage
274
275 class PreferencesWindow(Gtk.Dialog):
276 """Displays global preferences windows."""
277@@ -55,8 +54,7 @@
278
279 def _create_pages(self):
280 return [("Identity", IdentityPage(self.config)),
281- ("Plugins", PluginsPage()),
282- ("Notifications", NotificationsPage(self.config))]
283+ ("Plugins", PluginsPage())]
284
285 def display(self):
286 self.window.show_all()
287
288=== removed file 'preferences/notifications.py'
289--- preferences/notifications.py 2011-09-05 03:44:26 +0000
290+++ preferences/notifications.py 1970-01-01 00:00:00 +0000
291@@ -1,79 +0,0 @@
292-# Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org>
293-#
294-# This program is free software; you can redistribute it and/or modify
295-# it under the terms of the GNU General Public License as published by
296-# the Free Software Foundation; either version 2 of the License, or
297-# (at your option) any later version.
298-#
299-# This program is distributed in the hope that it will be useful,
300-# but WITHOUT ANY WARRANTY; without even the implied warranty of
301-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
302-# GNU General Public License for more details.
303-#
304-# You should have received a copy of the GNU General Public License
305-# along with this program; if not, write to the Free Software
306-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
307-
308-from gi.repository import Gtk
309-
310-import bzrlib.plugins.gtk
311-from bzrlib.plugins.gtk.notify import (
312- has_avahi,
313- has_dbus,
314- )
315-
316-
317-def has_email():
318- return (getattr(bzrlib.plugins, "email", None) is not None)
319-
320-def has_cia():
321- return (getattr(bzrlib.plugins, "cia", None) is not None)
322-
323-
324-class NotificationsPage(Gtk.VBox):
325-
326- def __init__(self, config, homogeneous=False, spacing=6):
327- self.config = config
328- super(NotificationsPage, self).__init__(
329- homogeneous=homogeneous, spacing=spacing)
330- self.set_spacing(spacing) # The vertical one
331-
332- lan_frame = Gtk.Frame(label="LAN Notifications")
333-
334- lan_vbox = Gtk.VBox()
335- lan_frame.add(lan_vbox)
336-
337- self.gateway_to_lan = Gtk.CheckButton("_Gateway to LAN")
338- lan_vbox.pack_start(self.gateway_to_lan, False, False, 0)
339- self.gateway_to_lan.set_sensitive(has_dbus())
340-
341- self.announce_on_lan = Gtk.CheckButton("_Announce on LAN")
342- lan_vbox.pack_start(self.announce_on_lan, False, False, 0)
343- self.announce_on_lan.set_sensitive(has_avahi())
344-
345- self.pack_start(lan_frame, False, False, 0)
346-
347- email_frame = Gtk.Frame(label="E-mail notifications")
348-
349- email_hbox = Gtk.HBox()
350- self.send_email = Gtk.CheckButton("Send _E-Mail to")
351- email_hbox.pack_start(self.send_email, False, False, 0)
352- self.send_email_to = Gtk.Entry()
353- email_hbox.pack_start(self.send_email_to, False, False, 0)
354-
355- email_frame.add(email_hbox)
356- email_frame.set_sensitive(has_email())
357-
358- self.pack_start(email_frame, False, False, 0)
359-
360- cia_frame = Gtk.Frame(label="CIA notifications")
361-
362- cia_user_hbox = Gtk.HBox()
363- cia_user_hbox.pack_start(Gtk.Label("Author name"), False, False, 0)
364- self.cia_user = Gtk.Entry()
365- cia_user_hbox.pack_start(self.cia_user, False, False, 0)
366-
367- cia_frame.add(cia_user_hbox)
368- cia_frame.set_sensitive(has_cia())
369-
370- self.pack_start(cia_frame, False, False, 0)
371
372=== modified file 'setup.py'
373--- setup.py 2012-02-28 17:45:56 +0000
374+++ setup.py 2012-07-10 08:40:24 +0000
375@@ -148,7 +148,7 @@
376 maintainer_email="jelmer@samba.org",
377 description="GTK+ Frontends for various Bazaar commands",
378 license="GNU GPL v2 or later",
379- scripts=['bzr-handle-patch', 'bzr-notify'],
380+ scripts=['bzr-handle-patch'],
381 url="http://bazaar-vcs.org/BzrGtk",
382 package_dir={
383 "bzrlib.plugins.gtk": ".",
384@@ -188,8 +188,7 @@
385 # In case Python distutils extra is not available,
386 # install the .desktop files
387 ('share/applications', ['bazaar-properties.desktop',
388- 'bzr-handle-patch.desktop',
389- 'bzr-notify.desktop']),
390+ 'bzr-handle-patch.desktop']),
391 ('share/application-registry', ['bzr-gtk.applications']),
392 ('share/pixmaps', ['icons/bzr-icon-64.png']),
393 ('share/icons/hicolor/scalable/apps',
394
395=== removed file 'tests/test_notify.py'
396--- tests/test_notify.py 2012-02-19 15:00:34 +0000
397+++ tests/test_notify.py 1970-01-01 00:00:00 +0000
398@@ -1,64 +0,0 @@
399-# -*- coding: utf-8 -*-
400-# Copyright (C) 2012 Curtis C. Hovey <sinzui.is@verizon.net>
401-#
402-# This program is free software; you can redistribute it and/or modify
403-# it under the terms of the GNU General Public License as published by
404-# the Free Software Foundation; either version 2 of the License, or
405-# (at your option) any later version.
406-#
407-# This program is distributed in the hope that it will be useful,
408-# but WITHOUT ANY WARRANTY; without even the implied warranty of
409-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
410-# GNU General Public License for more details.
411-#
412-# You should have received a copy of the GNU General Public License
413-# along with this program; if not, write to the Free Software
414-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
415-
416-import os
417-import subprocess
418-
419-from bzrlib import tests
420-from bzrlib.plugins.gtk.notify import NotifyPopupMenu
421-
422-
423-class FakeNotifyPopupMenu(NotifyPopupMenu):
424-
425- SHOW_WIDGETS = False
426-
427-
428-class NotifyPopupMenuTestCase(tests.TestCase):
429-
430- def test_init(self):
431- menu = FakeNotifyPopupMenu()
432- items = menu.get_children()
433- self.assertEqual(8, len(items))
434- self.assertEqual('_Gateway to LAN', items[0].props.label)
435- self.assertEqual('Announce _branches on LAN', items[2].props.label)
436- self.assertEqual('gtk-preferences', items[4].props.label)
437- self.assertEqual('gtk-about', items[5].props.label)
438- self.assertEqual('gtk-quit', items[7].props.label)
439-
440-
441-class BzrNotifyTestCase(tests.TestCase):
442-
443- def setUp(self):
444- top = os.path.abspath(os.path.join(
445- os.path.dirname(__file__), os.pardir))
446- self.script = os.path.join(top, 'bzr-notify')
447- self.env = dict(os.environ)
448- self.env['BZR_PLUGINS_AT'] = 'gtk@%s' % top
449- super(BzrNotifyTestCase, self).setUp()
450-
451- def test_smoketest(self):
452- # This is a smoke test to verify the process starts.
453- # The logic of the module must be moved into notify.py
454- # where it can be properly tested.
455- bzr_notify = subprocess.Popen(
456- [self.script, 'test'],
457- stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=self.env)
458- stdout, stderr = bzr_notify.communicate()
459- self.assertEqual('', stdout)
460- self.assertTrue(
461- stderr in (
462- '', 'ERROR:root:Could not find any typelib for AppIndicator3\n'))

Subscribers

People subscribed via source and target branches

to all changes: