Commit Graph

43 Commits

Author SHA1 Message Date
Augie Fackler
b35328ab65 error: add a new UnknownIdentifier error type
This will be used by the revset and fileset code to communicate more
specific errors to higher levels so that we might be able to offer
suggestions about what function might have been similar.
2015-01-26 14:31:01 -05:00
Mike Edgar
b4a5dfbe4d changegroup: emit full-replacement deltas if either revision is censored
To ensure that exchanged deltas in the presence of censored revisions can
always be applied to the recipient repository, the deltas must replace the
entire base text. To make this restriction reasonably enforceable, the delta
must do so with a single patch operation.

For background and broader design of the censorship feature, see:
http://mercurial.selenic.com/wiki/CensorPlan
2015-01-21 22:09:32 -05:00
Siddharth Agarwal
f7ee37c26e error.LookupError: rename 'message' property to something else
At least some installs of Python 2.6+ complain with:

    mercurial/error.py:26: DeprecationWarning: BaseException.message has been
        deprecated as of Python 2.6

This patch renames the property away from 'message' so that Python no longer
complains.
2015-02-18 16:45:16 -08:00
Mike Edgar
9635f8c5b0 revlog: in addgroup, reject ill-formed deltas based on censored nodes
To ensure interoperability when clones disagree about which file nodes are
censored, a restriction is made on deltas based on censored nodes. Any such
delta must replace the full text of the base in a single patch.

If the recipient of a delta considers the base to be censored and the delta
is not in the expected form, the recipient must reject it, as it can't know
if the source has also censored the base.

For background and broader design of the censorship feature, see:
http://mercurial.selenic.com/wiki/CensorPlan
2015-02-06 00:55:29 +00:00
Augie Fackler
e17e818366 error: update docstring on ParseError
It's now used by revsets and filesets.
2015-01-26 14:30:12 -05:00
Martin von Zweigbergk
20c7bd86fa error: store filename and message on LookupError for later
It may be useful to be able to get to the failed path and the
underlying error message when catching a LookupError, so let's make
them accessible.
2015-02-04 13:57:35 -08:00
Pierre-Yves David
6cf24b99de hook: raise a more specialized HookAbort exception when a hook fails
We need to gracefully handle some aborts for pushkey, especially
because it leads to a user-facing crash over the wireprotocols. So we
need a more specialized exception to catch.
2014-11-29 19:13:35 -08:00
Pierre-Yves David
5cf4921b01 repoview: add a FilteredRepoLookupError
This exception is a more precise RepoLookupError that will allow us to issue
a special message when we end up accessing a filtered revision.
2014-10-16 02:06:12 -07:00
Pierre-Yves David
37d7d2958f repoview: add a FilteredLookupError class
This exception is a more precise LookupError that will allow us to
issue a special message when we end up accessing a filtered revision.
2014-10-16 02:05:06 -07:00
Pierre-Yves David
ea3e835124 repoview: add a FilteredIndexError class
This exception is a more precise IndexError that will allow us to
issue a special message when we end up accessing a filtered revision.
2014-10-15 17:02:44 -07:00
Pierre-Yves David
2ecc46cd04 bundle2: add an UnsupportedPartError
We need the BundleValueError for format errors not related to part support. So
we add a specific class for part-support errors.
2014-10-15 03:22:47 -07:00
Mike Edgar
e100ea2d6a error: add CensoredNodeError, will be thrown when content deliberately erased
This change introduces the error plus a corresponding catch in dispatch, to
provide localized error messages.

The verb "censor" is used in this commit and all following to refer to erasing
the content of a revlog revision (filelog, for now) without recalculating node
IDs, leaving that revision invalid. Further work must be done to safely share
such revision data with compliant clients.

I find the analogy to censorship straightforward; for less politically
charged options, consider "erase", "excise", "expunge", or "blackhole".
2014-09-03 15:59:03 -04:00
Mike Edgar
be835fe233 error: use docstrings, not bare strings, for error classes 2014-08-30 12:22:20 +02:00
Brendan Cully
84c737c817 error: restore python 2.4 compatibility for BundleValueError
Under python 2.4, this:
    super(BundleValueError, self).__init__(msg)
raises this:
    TypeError: super() argument 1 must be type, not classobj
2014-06-10 17:00:31 -07:00
Pierre-Yves David
ee9ac67c31 bundle2: support None parttype in BundleValueError
This will be used for errors at the stream level.
2014-05-28 16:46:58 -07:00
Pierre-Yves David
e625997ab5 bundle2: introduce a `params` attribute to BundleValueError
We'll first use it for unsupported mandatory parameters on parts.
2014-05-28 15:53:34 -07:00
Pierre-Yves David
72ac6a7248 bundle2: introduce a parttype attribute to BundleValueError
We will use the Exception for more that just unknown part type.
2014-05-28 15:51:19 -07:00
Pierre-Yves David
d9f1652a77 bundle2: move exception classes into the error module
Exceptions should have known their place.
2014-05-28 15:31:05 -07:00
Pierre-Yves David
716843e5d3 bundle2: fix raising errors during heads checking
If the heads on the server differ from the ones reported seen by the client at
bundle time, we raise a PushRaced exception. However, the part raising the
exception was broken.

To fix it, we move the PushRaced class in the error module so it can be
accessible everywhere without an import cycle.

A test is also added to prevent regression.
2014-04-21 18:59:09 -07:00
Augie Fackler
91bbcff92c error: introduce new InterventionRequired exception
Future changes will use this type instead of util.Abort for signalling
the user that intervention is required, as in some rebase and histedit
aborts.
2013-02-08 14:26:03 -06:00
Takumi IINO
94c0d6fcb6 hgweb: show correct error message for i18n environment
If exception is error.LookupError and running in i18n environment,
below condition is always true.
Because msg is translated and dosen't contain 'manifest'.

    if util.safehasattr(err, 'name') and 'manifest' not in msg:

This patch creates a new exception class and uses it instead of
string match.
2013-02-15 18:07:14 +09:00
Andrew Pritchard
2d8acb3e0b wireproto: add out-of-band error class to allow remote repo to report errors
Older clients will still print the provided error message and not much else:
over ssh, this will be each line prefixed with 'remote: ' in addition to an
"abort: unexpected response: '\n'"; over http, this will be the '---%<---'
banners in addition to the 'does not appear to be a repository' message.

Currently, clients with this patch will display 'abort: remote error:\n' and
the provided error text, but it is trivial to style the error text however is
deemed appropriate.
2011-08-02 15:21:10 -04:00
Pierre-Yves David
f95a6cfc12 error: Add a hint argument to RepoError
This use the same mechanism than Abort. Except clause stay distinct
because RepoError add "!" at the end of the message.
2011-06-25 02:30:17 +02:00
Adrian Buehlmann
a8a418601f introduce new RequirementError (issue2649)
This improves the misleading error message

  $ hg identify
  abort: there is no Mercurial repository here (.hg not found)!

to the more explicit

  $ hg identify
  abort: requirement 'fake' not supported!

for all commands in commands.optionalrepo, which includes the identify
and serve commands in particular.

This is for the case when a new entry in .hg/requires will be defined
in a future Mercurial release.
2011-02-18 20:25:25 +01:00
Benoit Boissinot
a13fa80461 Abort: add a hint argument, printed in the next line inside parenthesis
discovery was using a custom made message for this purpose
push now returns -1 after aborting, instead of 1 previously
2010-07-15 14:41:22 +02:00
Matt Mackall
476998d3a8 error: fix up test-hgrc 2010-06-04 23:04:31 -05:00
Matt Mackall
969c51b3cf error: add new ParseError for various parsing errors 2010-06-04 20:57:26 -05:00
Matt Mackall
13c76ff349 error: change ParseError to CommandError 2010-06-04 20:19:53 -05:00
Matt Mackall
595d66f424 Update license to GPLv2+ 2010-01-19 22:20:08 -06:00
Matt Mackall
c34b180a9c Make distinct lookup error for localrepo.lookup
This allows clone/share to correctly distinguish lookup errors from
corruption errors and catch only the former.
2009-08-31 10:58:33 -05:00
Martin Geisler
2c8901a1b9 turn some comments back into module docstrings 2009-04-26 01:24:49 +02:00
Martin Geisler
8e4bc1e9ad put license and copyright info into comment blocks 2009-04-26 01:13:08 +02:00
Martin Geisler
750183bdad updated license to be explicit about GPL version 2 2009-04-26 01:08:54 +02:00
Matt Mackall
e8b3de6bf8 ui: introduce new config parser 2009-04-23 15:40:10 -05:00
Matt Mackall
2cddde0437 move util.Abort to error.py 2009-04-03 13:20:52 -05:00
Matt Mackall
104a85dee5 error: move SignatureError 2009-01-12 13:51:43 -06:00
Matt Mackall
7f3bf9b19d error: move SignalInterrupt
now derived from KeyboardInterrupt to simplify catches
2009-01-12 11:48:05 -06:00
Matt Mackall
e61d364b61 error: move UnknownCommand and AmbiguousCommand 2009-01-12 11:39:38 -06:00
Matt Mackall
534da54d07 error: move UnexpectedOutput (now ResponseError) 2009-01-12 11:28:28 -06:00
Matt Mackall
76c90d50e6 error: move lock errors
rename LockException to LockError
2009-01-12 11:09:14 -06:00
Matt Mackall
e0735a1762 error: move repo errors
rename NoCapability to CapabilityError
2009-01-12 10:42:31 -06:00
Matt Mackall
d3bf622cc2 error: move ParseError 2009-01-11 23:04:24 -06:00
Matt Mackall
d15d559b7c errors: move revlog errors
- create error.py for exception classes to reduce demandloading
- move revlog exceptions to it
- change users to import error and drop revlog import if possible
2009-01-11 22:48:28 -06:00