diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py --- a/mercurial/bundlerepo.py +++ b/mercurial/bundlerepo.py @@ -48,7 +48,7 @@ class bundlerevlog(revlog.revlog): continue for p in (p1, p2): if not p in self.nodemap: - raise revlog.LookupError(_("unknown parent %s") % short(p1)) + raise revlog.LookupError(hex(p1), _("unknown parent %s") % short(p1)) if linkmapper is None: link = n else: diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -100,13 +100,13 @@ class changectx(object): try: return self._manifest[path], self._manifest.flags(path) except KeyError: - raise revlog.LookupError(_("'%s' not found in manifest") % path) + raise revlog.LookupError(path, _("'%s' not found in manifest") % path) if '_manifestdelta' in self.__dict__ or path in self.files(): if path in self._manifestdelta: return self._manifestdelta[path], self._manifestdelta.flags(path) node, flag = self._repo.manifest.find(self._changeset[0], path) if not node: - raise revlog.LookupError(_("'%s' not found in manifest") % path) + raise revlog.LookupError(path, _("'%s' not found in manifest") % path) return node, flag diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -31,8 +31,13 @@ REVLOG_DEFAULT_VERSION = REVLOG_DEFAULT_ class RevlogError(Exception): pass + class LookupError(RevlogError): - pass + def __init__(self, name, message=None): + if message is None: + message = _('not found: %s') % name + RevlogError.__init__(self, message) + self.name = name def getoffset(q): return int(q >> 16) @@ -516,7 +521,7 @@ class revlog(object): try: return self.nodemap[node] except KeyError: - raise LookupError(_('%s: no node %s') % (self.indexfile, hex(node))) + raise LookupError(hex(node), _('%s: no node %s') % (self.indexfile, hex(node))) def node(self, rev): return self.index[rev][7] def linkrev(self, node): @@ -836,7 +841,8 @@ class revlog(object): for n in self.nodemap: if n.startswith(bin_id) and hex(n).startswith(id): if node is not None: - raise LookupError(_("Ambiguous identifier")) + raise LookupError(hex(node), + _("Ambiguous identifier")) node = n if node is not None: return node @@ -855,7 +861,7 @@ class revlog(object): if n: return n - raise LookupError(_("No match found")) + raise LookupError(id, _("No match found")) def cmp(self, node, text): """compare text with a given file revision""" @@ -1166,13 +1172,13 @@ class revlog(object): for p in (p1, p2): if not p in self.nodemap: - raise LookupError(_("unknown parent %s") % short(p)) + raise LookupError(hex(p), _("unknown parent %s") % short(p)) if not chain: # retrieve the parent revision of the delta chain chain = p1 if not chain in self.nodemap: - raise LookupError(_("unknown base %s") % short(chain[:4])) + raise LookupError(hex(chain), _("unknown base %s") % short(chain[:4])) # full versions are inserted when the needed deltas become # comparable to the uncompressed text or when the previous