Rev 19: Change the Revision signal to supply a list of urls, rather than a single url. in file:///home/robertc/source/baz/plugins/dbus/trunk/

Robert Collins robertc at robertcollins.net
Sun Mar 25 23:13:30 BST 2007


At file:///home/robertc/source/baz/plugins/dbus/trunk/

------------------------------------------------------------
revno: 19
revision-id: robertc at robertcollins.net-20070325221328-nttyoatqzu9b6lot
parent: robertc at robertcollins.net-20070325215659-e0jswadjeeef7rfs
committer: Robert Collins <robertc at robertcollins.net>
branch nick: trunk
timestamp: Mon 2007-03-26 08:13:28 +1000
message:
  Change the Revision signal to supply a list of urls, rather than a single url.
modified:
  activity.py                    activity.py-20070206034725-q208d0jtkshwu0fx-1
  tests/test_activity.py         test_activity.py-20070206035206-bnhzvtm6m6hpgylz-1
=== modified file 'activity.py'
--- a/activity.py	2007-03-23 22:40:20 +0000
+++ b/activity.py	2007-03-25 22:13:28 +0000
@@ -148,8 +148,8 @@
         To avoid information disclosure, no details are handed over the wire:
         clients should access the revision to determine its contents.
         """
-        self.Revision(revision_id, url)
+        self.Revision(revision_id, [url])
 
-    @dbus.service.signal(DBUS_INTERFACE)
-    def Revision(self, revision, url):
+    @dbus.service.signal(DBUS_INTERFACE, 'sas')
+    def Revision(self, revision, urls):
         """A revision has been observed at url."""

=== modified file 'tests/test_activity.py'
--- a/tests/test_activity.py	2007-03-23 11:06:53 +0000
+++ b/tests/test_activity.py	2007-03-25 22:13:28 +0000
@@ -175,8 +175,8 @@
             activity.Broadcast.DBUS_PATH)
         # we want to recieve the callbacks to inspect them.
         branches = []
-        def catch_branch(revision, url):
-            branches.append((revision, url))
+        def catch_branch(revision, urls):
+            branches.append((revision, urls))
         dbus_object.connect_to_signal("Revision", catch_branch,
             dbus_interface=activity.Broadcast.DBUS_INTERFACE)
 
@@ -186,7 +186,7 @@
         # now, let the broadcast method interactions all happen
 
         # '' because the branch has no commits.
-        self.assertEqual([('', branch.base)], branches)
+        self.assertEqual([('', [branch.base])], branches)
 
     def test_advertise_branch_service_running_with_commits(self):
         """With commits, the commit is utf8 encoded."""
@@ -199,8 +199,8 @@
             activity.Broadcast.DBUS_PATH)
         # we want to recieve the callbacks to inspect them.
         branches = []
-        def catch_branch(revision, url):
-            branches.append((revision, url))
+        def catch_branch(revision, urls):
+            branches.append((revision, urls))
         dbus_object.connect_to_signal("Revision", catch_branch,
             dbus_interface=activity.Broadcast.DBUS_INTERFACE)
 
@@ -216,7 +216,7 @@
         # in theory, the revid here would be utf8 encoded, but dbus seems to
         # consider 'string' == 'unicode', and 'Magic happens' as far as wire
         # level decoding -> unicode results. CRY.
-        self.assertEqual([(u'\xc8', tree.branch.base)], branches)
+        self.assertEqual([(u'\xc8', [tree.branch.base])], branches)
 
     def test_constructor(self):
         """The constructor should setup a good working environment."""
@@ -259,8 +259,8 @@
         self.assertTrue(started)
         # catch revisions
         revisions = []
-        def catch_revision(revision, url):
-            revisions.append((revision, url))
+        def catch_revision(revision, urls):
+            revisions.append((revision, urls))
             # quit the loop as soon as it idles.
         dbus_object.connect_to_signal("Revision", catch_revision,
             dbus_interface=activity.Broadcast.DBUS_INTERFACE)
@@ -268,7 +268,7 @@
         activity.Activity(bus=self.bus).announce_revision('foo', 'bar')
         # now, we need to block until the server has exited.
         # and finally, we can checkout our results.
-        self.assertEqual([('foo', 'bar')], revisions)
+        self.assertEqual([('foo', ['bar'])], revisions)
         # FUGLY: there seems to be a race condition where the finish
         # call hung, and I've not the time to debug it right now.
         time.sleep(0.05)
@@ -287,12 +287,12 @@
             activity.Broadcast.DBUS_INTERFACE)
         # we want to recieve the callbacks to inspect them.
         signals1 = []
-        def catch_signal1(revision, url):
-            signals1.append((revision, url))
+        def catch_signal1(revision, urls):
+            signals1.append((revision, urls))
         # second method to avoid any possible dbus muppetry
         signals2 = []
-        def catch_signal2(revision, url):
-            signals2.append((revision, url))
+        def catch_signal2(revision, urls):
+            signals2.append((revision, urls))
         dbus_object.connect_to_signal("Revision", catch_signal1,
             dbus_interface=activity.Broadcast.DBUS_INTERFACE)
         dbus_object.connect_to_signal("Revision", catch_signal2,
@@ -323,7 +323,7 @@
         mainloop.run()
         if errors:
             raise errors[0]
-        self.assertEqual([('revision1', 'url1'), ('revision2', 'url2')],
+        self.assertEqual([('revision1', ['url1']), ('revision2', ['url2'])],
             signals1)
-        self.assertEqual([('revision1', 'url1'), ('revision2', 'url2')],
+        self.assertEqual([('revision1', ['url1']), ('revision2', ['url2'])],
             signals2)



More information about the bazaar-commits mailing list