702
702
# TODO: Probably this behavior of should be a common superclass
703
703
class NotBranchError(PathError):
705
_fmt = 'Not a branch: "%(path)s"%(extra)s.'
705
_fmt = 'Not a branch: "%(path)s"%(detail)s.'
707
def __init__(self, path, detail=None):
707
def __init__(self, path, bzrdir=None):
708
708
import bzrlib.urlutils as urlutils
709
709
path = urlutils.unescape_for_display(path, 'ascii')
710
710
# remember the detail in case of remote serialization
712
PathError.__init__(self, path=path, extra=self.detail)
713
PathError.__init__(self, path=path)
716
# XXX: Ideally self.detail would be a property, but Exceptions in
717
# Python 2.4 have to be old-style classes so properties don't work.
718
# Instead we override _format.
719
if self.detail is None:
720
if self.bzrdir is not None:
722
self.bzrdir.open_repository()
723
except NoRepositoryPresent:
726
self.detail = ': location is a repository'
729
return PathError._format(self)
715
732
class NoSubmitBranch(PathError):