diff --git a/hgext/imerge.py b/hgext/imerge.py --- a/hgext/imerge.py +++ b/hgext/imerge.py @@ -79,7 +79,8 @@ class Imerge(object): try: parents = [self.repo.changectx(n) for n in status[:2]] except revlog.LookupError, e: - raise util.Abort('merge parent %s not in repository' % e.name) + raise util.Abort(_('merge parent %s not in repository') % + short(e.name)) status = status[2:] conflicts = int(status.pop(0)) * 3 diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py --- a/mercurial/bundlerepo.py +++ b/mercurial/bundlerepo.py @@ -48,7 +48,8 @@ class bundlerevlog(revlog.revlog): continue for p in (p1, p2): if not p in self.nodemap: - raise revlog.LookupError(hex(p1), _("unknown parent %s") % short(p1)) + raise revlog.LookupError(p1, self.indexfile, + _("unknown parent")) 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,15 @@ class changectx(object): try: return self._manifest[path], self._manifest.flags(path) except KeyError: - raise revlog.LookupError(path, _("'%s' not found in manifest") % path) + raise revlog.LookupError(self._node, path, + _('not found in manifest')) 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(path, _("'%s' not found in manifest") % path) + raise revlog.LookupError(self._node, path, + _('not found in manifest')) return node, flag diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -33,11 +33,11 @@ class RevlogError(Exception): pass class LookupError(RevlogError): - def __init__(self, name, message=None): - if message is None: - message = _('not found: %s') % name - RevlogError.__init__(self, message) + def __init__(self, name, index, message): self.name = name + if isinstance(name, str) and len(name) == 20: + name = short(name) + RevlogError.__init__(self, _('%s@%s: %s') % (index, name, message)) def getoffset(q): return int(q >> 16) @@ -519,7 +519,7 @@ class revlog(object): try: return self.nodemap[node] except KeyError: - raise LookupError(hex(node), _('%s: no node %s') % (self.indexfile, hex(node))) + raise LookupError(node, self.indexfile, _('no node')) def node(self, rev): return self.index[rev][7] def linkrev(self, node): @@ -839,8 +839,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(hex(node), - _("Ambiguous identifier")) + raise LookupError(id, self.indexfile, + _('ambiguous identifier')) node = n if node is not None: return node @@ -859,7 +859,7 @@ class revlog(object): if n: return n - raise LookupError(id, _("No match found")) + raise LookupError(id, self.indexfile, _('no match found')) def cmp(self, node, text): """compare text with a given file revision""" @@ -1170,13 +1170,13 @@ class revlog(object): for p in (p1, p2): if not p in self.nodemap: - raise LookupError(hex(p), _("unknown parent %s") % short(p)) + raise LookupError(p, self.indexfile, _('unknown parent')) if not chain: # retrieve the parent revision of the delta chain chain = p1 if not chain in self.nodemap: - raise LookupError(hex(chain), _("unknown base %s") % short(chain[:4])) + raise LookupError(chain, self.indexfile, _('unknown base')) # full versions are inserted when the needed deltas become # comparable to the uncompressed text or when the previous diff --git a/tests/test-bundle-r.out b/tests/test-bundle-r.out --- a/tests/test-bundle-r.out +++ b/tests/test-bundle-r.out @@ -168,7 +168,7 @@ 2:d62976ca1e50 adding changesets transaction abort! rollback completed -abort: unknown parent ac69c658229d! +abort: 00changelog.i@ac69c658229d: unknown parent! % 2 2:d62976ca1e50 adding changesets diff --git a/tests/test-diffdir.out b/tests/test-diffdir.out --- a/tests/test-diffdir.out +++ b/tests/test-diffdir.out @@ -18,5 +18,5 @@ diff -r acd8075edac9 b +++ b/b @@ -0,0 +1,1 @@ +123 -abort: Ambiguous identifier! -abort: Ambiguous identifier! +abort: 00changelog.i@: ambiguous identifier! +abort: 00changelog.i@: ambiguous identifier! diff --git a/tests/test-imerge.out b/tests/test-imerge.out --- a/tests/test-imerge.out +++ b/tests/test-imerge.out @@ -47,4 +47,4 @@ 2 files updated, 0 files merged, 1 files % nothing to merge abort: there is nothing to merge - use "hg update" instead % load unknown parent -abort: merge parent e6da4671640124fe5d3d70d2f54441d6cd76ae35 not in repository +abort: merge parent e6da46716401 not in repository diff --git a/tests/test-log.out b/tests/test-log.out --- a/tests/test-log.out +++ b/tests/test-log.out @@ -220,4 +220,4 @@ date: Thu Jan 01 00:00:01 1970 +0 summary: b1 % log -r "" -abort: Ambiguous identifier! +abort: 00changelog.i@: ambiguous identifier!