# error.py - Mercurial exceptions
#
class RevlogError(Exception):
class LookupError(RevlogError, KeyError):
name = short(name)
RevlogError.__init__(self, '%s@%s: %s' % (index, name, message))
def __str__(self):
return RevlogError.__str__(self)
class ManifestLookupError(LookupError):
class CommandError(Exception):
"""Exception raised on errors in parsing the command line."""
import sys, os, re
import util, config, templatefilters, templatekw, parser, error
else:
raise error.ParseError(_("unterminated string"), s)
else:
raise error.ParseError(_("syntax error"), pos)
return context._load(exp[1])
raise error.ParseError(_("expected template specifier"))
return filt(func(context, mapping, data))
except (ValueError, AttributeError, TypeError):
if len(args) != 1:
raise error.ParseError(_("filter %s expects one argument") % n)
return (runfilter, (args[0][0], args[0][1], f))
raise error.ParseError(_("unknown function '%s'") % n)
if not (1 <= len(args) <= 2):
raise error.ParseError(_("date expects one or two arguments"))
import os, sys, atexit, signal, pdb, socket, errno, shlex, time, traceback, re
import util, commands, hg, fancyopts, extensions, hook, error
# input/output/error streams
# Mercurial-specific first, followed by built-in and library exceptions
except error.AmbiguousCommand, inst:
(inst.args[0], " ".join(inst.args[1])))
except error.ParseError, inst:
if len(inst.args) > 1:
ui.warn(_("hg: parse error at %s: %s\n") %
else:
ui.warn(_("hg: parse error: %s\n") % inst.args[0])
return -1
except error.LockHeld, inst:
ui.warn(_("abort: %s: %s\n") % (inst.desc or inst.filename, reason))
except error.LockUnavailable, inst:
ui.warn(_("abort: could not lock %s: %s\n") %
import re
import parser, util, error, discovery, hbisect, phases
else:
raise error.ParseError(_("unterminated string"), s)
else:
raise error.ParseError(_("syntax error"), pos)
if x in symbols:
raise error.ParseError(_("can't use %s here") % x)
def listset(repo, subset, a, b):
raise error.ParseError(_("can't use a list in this context"))
return symbols[a[1]](repo, subset, b)
raise error.ParseError(_("not a function: %s") % a[1])
bundlerevs = repo.changelog.bundlerevs
except AttributeError:
gr = re.compile(getstring(x, _("grep requires a string")))
except re.error, e:
msgid ""
"config error - hook type \"%s\" cannot stop incoming changesets nor commits"
#, python-format
msgid "Bugzilla error: %s"
msgid ""
" :convert.hg.ignoreerrors: ignore integrity errors when reading.\n"
#, python-format
msgid "syntax error in %s(%d): child parent1[,parent2] expected"
#, python-format
msgid "splicemap file not found or error reading %s:"
#, python-format
msgid "error reading cache: %r\n"
msgid "error while signing"
#, python-format
msgid "error getting id %s from url %s for file %s: %s\n"
msgid ""
"config error - hook type \"%s\" cannot stop incoming changesets nor commits"
msgstr ""
"errore di configurazione - l'hook di tipo \"%s\" non può fermare né i "
msgid ""
" :convert.hg.ignoreerrors: ignore integrity errors when reading.\n"
#, python-format
msgid "%s error:\n"
msgstr "%s errore:\n"
#, python-format
msgid "syntax error in %s(%d): key/value pair expected"
msgid "errors in filemap"
msgstr "errori nel filemap"
msgid ""
" :convert.hg.ignoreerrors: ignore integrity errors when reading.\n"
msgstr ""
" :convert.hg.ignoreerrors: ignora erros de integridade na leitura.\n"
#, python-format
msgid "%s error:\n"
msgid "errors in filemap"
#, python-format
msgid "warning: ignoring .hgeol file due to parse error at %s: %s\n"
msgid "error while signing"
#, python-format
msgid "error getting id %s from url %s for file %s: %s\n"
#, python-format
msgid "error removing undo: %s\n"
msgid ""
"config error - hook type \"%s\" cannot stop incoming changesets nor commits"
#, python-format
msgid "Bugzilla error: %s"
#, python-format
msgid "%s error:\n"
#, python-format
msgid "syntax error in %s(%d): key/value pair expected"
#, python-format
msgid "error reading cache: %r\n"
msgid "error while signing"
#, python-format
msgid "error removing undo: %s\n"
#, python-format
msgid "errors during apply, please fix and refresh %s\n"
#, python-format
msgid "Bugzilla error: %s"
#, python-format
msgid "%s error:\n"
#, python-format
msgid "syntax error in %s(%d): key/value pair expected"
#, python-format
msgid "warning: ignoring .hgeol file due to parse error at %s: %s\n"
msgid "error while signing"
#, python-format
msgid "%s returned an error: %s"
#, python-format
msgid "error removing undo: %s\n"
#, python-format
msgid "error unlinking %s\n"
from mercurial import commands, cmdutil, hg, scmutil, util, revset
from mercurial import extensions, error, phases
stripext = extensions.find('strip')
except KeyError:
self.comments.insert(patchheaderat + 1, '# User ' + user)
except ValueError:
class AbortNoCleanup(error.Abort):
curpath = os.path.join(path, 'patches-' + cur)
except IOError:
os.unlink(undo)
except OSError, inst:
self.ui.warn(_('error removing undo: %s\n') % str(inst))
tobackup=None, keepchanges=False):
"""returns (error, hash)
hg-binary
(error "No `hg' executable found!")))
(defun hg-find-file-hook ()
(ignore-errors
(defun hg-after-save-hook ()
(ignore-errors
(if (not hg-root-dir)
(error "error: %s: directory is not part of a Mercurial repository."
(interactive)
(error "not implemented"))
(not hg-commit-allow-empty-message))
(error "Cannot proceed - commit message is empty"))
(unless root
(error "Cannot commit outside a repository!"))
(not hg-commit-allow-empty-file-list))
(error "No pending changes to commit"))
import changegroup as changegroupmod, bundle2, pushkey as pushkeymod
import peer, error, encoding, util, store, exchange
returns a list of values (same order as <args>)"""
raise NotImplementedError()
"""
raise NotImplementedError()
See also the `restore` method."""
raise NotImplementedError()
# """
# raise NotImplementedError()
except TypeError:
self._abort(error.ResponseError(_("unexpected response:"), d))
return br
except ValueError:
from i18n import _
import config, util, node, error, cmdutil, bookmarks, match as matchmod
class SubrepoAbort(error.Abort):
"""Exception class used to avoid handling a subrepo error more than once"""
def __init__(self, *args, **kw):
error.Abort.__init__(self, *args, **kw)
def annotatesubrepoerror(func):
"""
raise NotImplementedError
state and working directory modifications"""
raise NotImplementedError
"""
raise NotImplementedError
from i18n import _
import mdiff, error, util, scmutil, subrepo, patch, encoding, phases
self._node = repo.changelog.node(changeid)
except IndexError:
raise error.RepoLookupError(
return
except LookupError:
if str(r) != changeid:
raise ValueError
if r < 0 or r >= l:
raise ValueError
return
except (ValueError, OverflowError, IndexError):
return
except (TypeError, LookupError):
import sys
import hg, scmutil, util, revlog, copies, error, bookmarks
Returns 0 on success, 1 if errors are encountered.
ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state))
errors += 1
(f, state))
errors += 1
ui.warn(_("%s in manifest1, but listed as state %s") % (f, state))
errors += 1
if errors:
elif rev is None:
raise error.CommandError('debugdata', _('invalid arguments'))
ui.write(r.revision(r.lookup(rev)))
except KeyError:
import re
import parser, error, util, merge
else:
raise error.ParseError(_("unterminated string"), s)
if len(l) < min or len(l) > max:
raise error.ParseError(err)
r = re.compile(getstring(x, _("grep requires a pattern")))
except re.error, e:
raise error.ParseError(_('invalid match pattern: %s') % e)
return [f for f in mctx.existing() if r.search(mctx.ctx[f].data())]
return int(s)
except ValueError:
raise error.ParseError(_("couldn't parse size: %s") % s)
else:
raise error.ParseError(_("couldn't parse size: %s") % expr)
# Modified by Augie Fackler:
# - add safesend method and use it to prevent broken pipe errors
If you want the best of both worlds, use this inside an
AttributeError-catching try:
>>> try: status = fo.status
>>> except AttributeError: status = None
easy to distinguish between non-200 responses. The reason is that
urllib2 tries to do clever things with error codes 301, 302, 401,
For python versions earlier than 2.4, you can avoid this fancy error
handling by setting the module-level global HANDLE_ERRORS to zero.
You see, prior to 2.4, it's the HTTP Handler's job to determine what
to handle specially, and what to just pass up. HANDLE_ERRORS == 0
longer belongs to the HTTP Handler and is now done by a NEW handler,
HTTPErrorProcessor. Here's the bottom line:
import transaction, store, encoding, exchange, bundle2
import scmutil, util, extensions, hook, error, revset
return ret
except error.PushRaced, exc:
raise error.ResponseError(_('push failed:'), str(exc))
if not vfs.exists():
raise error.RepoError(
self.sharedpath = s
except IOError, inst:
return node
except error.LookupError:
fp = self.opener('localtags', 'r+')
except IOError:
fp = self.wfile('.hgtags', 'rb+')
except IOError, e:
#, python-format
msgid "config error - hook type \"%s\" cannot stop incoming changesets"
#, python-format
msgid "database error: %s"
#, python-format
msgid "error reading cache: %r\n"
msgid "Error while signing"
#, python-format
msgid "error removing undo: %s\n"
#, python-format
msgid "error unlinking %s\n"
#, python-format
msgid "Error folding patch %s"
msgid ""
"If you notice \"BROKEN PIPE\" error messages, you can disable them by\n"
from mercurial.node import bin, hex, nullid
from mercurial import hg, util, context, bookmarks, error, scmutil
% path)
except error.RepoError, err:
converter_source.__init__(self, ui, path, rev)
self.ignoreerrors = ui.configbool('convert', 'hg.ignoreerrors', False)
if not self.repo.local():
raise error.RepoError
except error.RepoError:
ui.traceback()
copies[name] = copysource
except TypeError:
pass
except error.LookupError, e:
if not self.ignoreerrors:
raise