322
322
class FilesExist(PathError):
323
"""Used when reporting that files do exist"""
324
_fmt = "File(s) exist: %(paths_as_string)s%(extra)s"
326
# used when reporting that files do exist
325
_fmt = "File%(plural)s exist: %(paths_as_string)s%(extra)s"
328
327
def __init__(self, paths, extra=None):
329
328
# circular import
330
329
from bzrlib.osutils import quotefn
331
330
BzrError.__init__(self)
332
331
self.paths = paths
333
self.paths_as_string = ' '.join([quotefn(p) for p in paths])
332
self.paths_as_string = ' '.join(paths)
335
334
self.extra = ': ' + str(extra)
339
342
class NotADirectory(PathError):
521
524
class AlreadyVersionedError(BzrError):
522
#Used when a path is expected not to be versioned, but it is.
525
"""Used when a path is expected not to be versioned, but it is."""
524
_fmt = "%(contextInfo)s%(path)s is already versioned"
527
_fmt = "%(context_info)s%(path)s is already versioned"
526
def __init__(self, path, contextInfo=None):
529
def __init__(self, path, context_info=None):
527
530
"""Construct a new NotVersionedError.
529
532
:param path: This is the path which is versioned,
530
533
which should be in a user friendly form.
531
:param contextInfo: If given, this is information about the context,
534
:param context_info: If given, this is information about the context,
532
535
which could explain why this is expected to not be versioned.
534
537
BzrError.__init__(self)
536
if contextInfo is None:
537
self.contextInfo = ''
539
if context_info is None:
540
self.context_info = ''
539
self.contextInfo = contextInfo + ": "
542
self.context_info = context_info + ". "
542
545
class NotVersionedError(BzrError):
543
#Used when a path is expected to be versioned, but it is not.
546
"""Used when a path is expected to be versioned, but it is not."""
545
_fmt = "%(contextInfo)s%(path)s is not versioned"
548
_fmt = "%(context_info)s%(path)s is not versioned"
547
def __init__(self, path, contextInfo=None):
550
def __init__(self, path, context_info=None):
548
551
"""Construct a new NotVersionedError.
550
553
:param path: This is the path which is not versioned,
551
554
which should be in a user friendly form.
552
:param contextInfo: If given, this is information about the context,
555
:param context_info: If given, this is information about the context,
553
556
which could explain why this is expected to be versioned.
555
558
BzrError.__init__(self)
557
if contextInfo is None:
558
self.contextInfo = ''
560
if context_info is None:
561
self.context_info = ''
560
self.contextInfo = contextInfo + ": "
563
self.context_info = context_info + ". "
563
566
class PathsNotVersionedError(BzrError):
564
# used when reporting several paths which are not versioned
567
"""Used when reporting several paths which are not versioned"""
566
569
_fmt = "Path(s) are not versioned: %(paths_as_string)s"