PageRenderTime 44ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/plugins/hg4idea/testData/bin/mercurial/error.py

http://github.com/JetBrains/intellij-community
Python | 96 lines | 51 code | 24 blank | 21 comment | 2 complexity | e46208d987c8f6803f18782bead2e2fd MD5 | raw file
Possible License(s): BSD-3-Clause, Apache-2.0, MPL-2.0-no-copyleft-exception, MIT, EPL-1.0, AGPL-1.0
  1. # error.py - Mercurial exceptions
  2. #
  3. # Copyright 2005-2008 Matt Mackall <mpm@selenic.com>
  4. #
  5. # This software may be used and distributed according to the terms of the
  6. # GNU General Public License version 2 or any later version.
  7. """Mercurial exceptions.
  8. This allows us to catch exceptions at higher levels without forcing
  9. imports.
  10. """
  11. # Do not import anything here, please
  12. class RevlogError(Exception):
  13. pass
  14. class LookupError(RevlogError, KeyError):
  15. def __init__(self, name, index, message):
  16. self.name = name
  17. if isinstance(name, str) and len(name) == 20:
  18. from node import short
  19. name = short(name)
  20. RevlogError.__init__(self, '%s@%s: %s' % (index, name, message))
  21. def __str__(self):
  22. return RevlogError.__str__(self)
  23. class ManifestLookupError(LookupError):
  24. pass
  25. class CommandError(Exception):
  26. """Exception raised on errors in parsing the command line."""
  27. class InterventionRequired(Exception):
  28. """Exception raised when a command requires human intervention."""
  29. class Abort(Exception):
  30. """Raised if a command needs to print an error and exit."""
  31. def __init__(self, *args, **kw):
  32. Exception.__init__(self, *args)
  33. self.hint = kw.get('hint')
  34. class ConfigError(Abort):
  35. 'Exception raised when parsing config files'
  36. class OutOfBandError(Exception):
  37. 'Exception raised when a remote repo reports failure'
  38. class ParseError(Exception):
  39. 'Exception raised when parsing config files (msg[, pos])'
  40. class RepoError(Exception):
  41. def __init__(self, *args, **kw):
  42. Exception.__init__(self, *args)
  43. self.hint = kw.get('hint')
  44. class RepoLookupError(RepoError):
  45. pass
  46. class CapabilityError(RepoError):
  47. pass
  48. class RequirementError(RepoError):
  49. """Exception raised if .hg/requires has an unknown entry."""
  50. pass
  51. class LockError(IOError):
  52. def __init__(self, errno, strerror, filename, desc):
  53. IOError.__init__(self, errno, strerror, filename)
  54. self.desc = desc
  55. class LockHeld(LockError):
  56. def __init__(self, errno, filename, desc, locker):
  57. LockError.__init__(self, errno, 'Lock held', filename, desc)
  58. self.locker = locker
  59. class LockUnavailable(LockError):
  60. pass
  61. class ResponseError(Exception):
  62. """Raised to print an error with part of output and exit."""
  63. class UnknownCommand(Exception):
  64. """Exception raised if command is not in the command table."""
  65. class AmbiguousCommand(Exception):
  66. """Exception raised if command shortcut matches more than one command."""
  67. # derived from KeyboardInterrupt to simplify some breakout code
  68. class SignalInterrupt(KeyboardInterrupt):
  69. """Exception raised on SIGTERM and SIGHUP."""
  70. class SignatureError(Exception):
  71. pass