Rev 5075: (spiv) Remove broken and apparently unused code path from in file:///home/pqm/archives/thelove/bzr/2.2/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri Aug 13 10:28:06 BST 2010


At file:///home/pqm/archives/thelove/bzr/2.2/

------------------------------------------------------------
revno: 5075 [merge]
revision-id: pqm at pqm.ubuntu.com-20100813092804-nwxty1x1vbzqtkan
parent: pqm at pqm.ubuntu.com-20100812041945-zbrgerx6ule5d6ef
parent: andrew.bennetts at canonical.com-20100813074351-m3br5t4dg7b7sj9o
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.2
timestamp: Fri 2010-08-13 10:28:04 +0100
message:
  (spiv) Remove broken and apparently unused code path from
   BranchInitHookParams.__repr__. (Andrew Bennetts)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
  bzrlib/tests/test_branch.py    test_branch.py-20060116013032-97819aa07b8ab3b5
  bzrlib/tests/test_bzrdir.py    test_bzrdir.py-20060131065654-deba40eef51cf220
=== modified file 'NEWS'
--- a/NEWS	2010-08-12 03:02:14 +0000
+++ b/NEWS	2010-08-13 07:33:28 +0000
@@ -30,6 +30,12 @@
 API Changes
 ***********
 
+Internals
+*********
+
+* Remove used and broken code path in ``BranchInitHookParams.__repr__``.
+  (Andrew Bennetts)
+
 Testing
 *******
 

=== modified file 'bzrlib/branch.py'
--- a/bzrlib/branch.py	2010-08-11 10:13:08 +0000
+++ b/bzrlib/branch.py	2010-08-13 07:32:06 +0000
@@ -1958,12 +1958,7 @@
         return self.__dict__ == other.__dict__
 
     def __repr__(self):
-        if self.branch:
-            return "<%s of %s>" % (self.__class__.__name__, self.branch)
-        else:
-            return "<%s of format:%s bzrdir:%s>" % (
-                self.__class__.__name__, self.branch,
-                self.format, self.bzrdir)
+        return "<%s of %s>" % (self.__class__.__name__, self.branch)
 
 
 class SwitchHookParams(object):

=== modified file 'bzrlib/tests/test_branch.py'
--- a/bzrlib/tests/test_branch.py	2010-06-20 21:14:49 +0000
+++ b/bzrlib/tests/test_branch.py	2010-08-13 07:32:06 +0000
@@ -552,6 +552,15 @@
         self.assertTrue(hasattr(params, 'bzrdir'))
         self.assertTrue(hasattr(params, 'branch'))
 
+    def test_post_branch_init_hook_repr(self):
+        param_reprs = []
+        _mod_branch.Branch.hooks.install_named_hook('post_branch_init',
+            lambda params: param_reprs.append(repr(params)), None)
+        branch = self.make_branch('a')
+        self.assertLength(1, param_reprs)
+        param_repr = param_reprs[0]
+        self.assertStartsWith(param_repr, '<BranchInitHookParams of ')
+
     def test_post_switch_hook(self):
         from bzrlib import switch
         calls = []

=== modified file 'bzrlib/tests/test_bzrdir.py'
--- a/bzrlib/tests/test_bzrdir.py	2010-06-29 16:21:13 +0000
+++ b/bzrlib/tests/test_bzrdir.py	2010-08-13 07:43:51 +0000
@@ -1401,3 +1401,13 @@
         self.assertIsInstance(params, RepoInitHookParams)
         self.assertTrue(hasattr(params, 'bzrdir'))
         self.assertTrue(hasattr(params, 'repository'))
+
+    def test_post_repo_init_hook_repr(self):
+        param_reprs = []
+        bzrdir.BzrDir.hooks.install_named_hook('post_repo_init',
+            lambda params: param_reprs.append(repr(params)), None)
+        self.make_repository('foo')
+        self.assertLength(1, param_reprs)
+        param_repr = param_reprs[0]
+        self.assertStartsWith(param_repr, '<RepoInitHookParams for ')
+




More information about the bazaar-commits mailing list