[Pkg-bazaar-commits] ./bzr-dbus/unstable r49: Merge patch to only warn when unable to contact DBus.

Jelmer Vernooij jelmer at samba.org
Fri Apr 10 12:28:41 UTC 2009


------------------------------------------------------------
revno: 49
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: debian
timestamp: Mon 2008-10-06 15:43:33 +0200
message:
  Merge patch to only warn when unable to contact DBus.
modified:
  debian/changelog
  hook.py
    ------------------------------------------------------------
    revno: 33.3.2
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: no-interrupt
    timestamp: Wed 2008-10-01 03:19:23 +0200
    message:
      only warn when unable to contact DBus.
    modified:
      hook.py
    ------------------------------------------------------------
    revno: 46.1.1
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: debian
    timestamp: Sun 2008-10-05 15:52:52 +0200
    message:
      Add patch to prevent immediate failure if dbus can't be contacted.
    modified:
      debian/changelog
      hook.py
-------------- next part --------------
=== modified file 'debian/changelog'
--- a/debian/changelog	2008-08-04 20:23:20 +0000
+++ b/debian/changelog	2008-10-06 13:43:33 +0000
@@ -1,3 +1,9 @@
+bzr-dbus (0.1~bzr36-3) unstable; urgency=low
+
+  * Add patch to prevent immediate failure if dbus can't be contacted.
+
+ -- Jelmer Vernooij <jelmer at samba.org>  Sun, 05 Oct 2008 15:51:19 +0200
+
 bzr-dbus (0.1~bzr36-2) unstable; urgency=low
 
   * Merged daemonless DBus patch from James Henstridge, required for bzr-avahi.

=== modified file 'hook.py'
--- a/hook.py	2008-08-04 20:23:20 +0000
+++ b/hook.py	2008-10-06 13:43:33 +0000
@@ -21,10 +21,12 @@
 
 from bzrlib.branch import Branch
 from bzrlib.smart.server import SmartTCPServer
+from bzrlib.trace import warning
 
 import activity
 from server_mainloop import (
     MainloopThread, install_hooks as install_mainloop_hooks)
+import dbus
 
 
 def install_hooks():
@@ -41,9 +43,20 @@
         'Unregistering server mapping')
 
 
+def get_activity():
+    try:
+        return activity.Activity()
+    except dbus.DBusException, e:
+        warning("Unable to contact DBus session: " + str(e))
+        return None
+
+
 def on_post_change_branch_tip(params):
     """Announce the new head revision of the branch to dbus."""
-    activity.Activity().advertise_branch(params.branch)
+    activity = get_activity()
+    if activity is None:
+        return
+    activity.advertise_branch(params.branch)
 
 
 _announcer = None
@@ -60,6 +73,6 @@
     get_announcer().on_server_started(backing_urls, public_url)
 
 
-def on_server_stop(backing_urls, public_url):
+def on_server_stop(local_urls, public_url):
     """The server has shutdown, so remove the servers local and public urls."""
     get_announcer().on_server_stopped(backing_urls, public_url)



More information about the Pkg-bazaar-commits mailing list