# HG changeset patch # User Mikael Berthe # Date 1126719310 18000 # Node ID 4a6efec8b6988f94b461568eea8e66b1a4b813ed # Parent 3b4f05ff31304bdf3abfef8d72ca50122d4cd765 Fix hg cat when the file cannot be found in the specified revision diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -579,8 +579,11 @@ def cat(ui, repo, file1, rev=None, **opt change = repo.changelog.read(n) m = repo.manifest.read(change[0]) n = m[relpath(repo, [file1])[0]] - except hg.RepoError, KeyError: - n = r.lookup(rev) + except (hg.RepoError, KeyError): + try: + n = r.lookup(rev) + except KeyError, inst: + raise util.Abort('cannot find file %s in rev %s', file1, rev) else: n = r.tip() fp = make_file(repo, r, opts['output'], node=n)