Rev 5115: (spiv) Override __repr__ in NotBranchError to avoid side-effects during in file:///home/pqm/archives/thelove/bzr/2.2/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon Dec 13 01:52:12 GMT 2010


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

------------------------------------------------------------
revno: 5115 [merge]
revision-id: pqm at pqm.ubuntu.com-20101213015210-816nvcpbwqajai5g
parent: pqm at pqm.ubuntu.com-20101202141229-wymlgvcy2q6l9zo8
parent: andrew.bennetts at canonical.com-20101210044818-1tk992xju33sudb2
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.2
timestamp: Mon 2010-12-13 01:52:10 +0000
message:
  (spiv) Override __repr__ in NotBranchError to avoid side-effects during
   repr(e). (Andrew Bennetts)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
=== modified file 'NEWS'
--- a/NEWS	2010-12-02 09:29:41 +0000
+++ b/NEWS	2010-12-10 04:48:18 +0000
@@ -25,6 +25,10 @@
 Bug Fixes
 *********
 
+* Don't probe for a repository from within ``NotBranchError.__repr__``,
+  because this can cause knock-on errors at awkward times.
+  (Andrew Bennetts, #687653)
+
 * RevisionTree.is_executable no longer returns None for directories and
   symlinks.  Instead, it returns False, like other Trees and methods.
   (Aaron Bentley, #681885)

=== modified file 'bzrlib/errors.py'
--- a/bzrlib/errors.py	2010-10-11 05:06:26 +0000
+++ b/bzrlib/errors.py	2010-12-10 04:48:18 +0000
@@ -713,6 +713,9 @@
        self.bzrdir = bzrdir
        PathError.__init__(self, path=path)
 
+    def __repr__(self):
+        return '<%s %r>' % (self.__class__.__name__, self.__dict__)
+
     def _format(self):
         # XXX: Ideally self.detail would be a property, but Exceptions in
         # Python 2.4 have to be old-style classes so properties don't work.




More information about the bazaar-commits mailing list