# HG changeset patch # User Artem Tikhomirov # Date 1329139176 -3600 # Node ID 6150555eb41dababa36605a41fe2419157584bab # Parent 4b97847d0b2d648cd2995a573c2421df4b52a51d HgInvalidRevisionException for svn imported repositories (changeset 0 references nullid manifest) diff -r 4b97847d0b2d -r 6150555eb41d src/org/tmatesoft/hg/core/HgInvalidRevisionException.java --- a/src/org/tmatesoft/hg/core/HgInvalidRevisionException.java Mon Feb 13 13:20:06 2012 +0100 +++ b/src/org/tmatesoft/hg/core/HgInvalidRevisionException.java Mon Feb 13 14:19:36 2012 +0100 @@ -90,8 +90,8 @@ return msg; } StringBuilder sb = new StringBuilder(); - sb.append('['); if (rev != null) { + sb.append("Revision:"); sb.append(rev.shortNotation()); sb.append(' '); } @@ -109,7 +109,6 @@ sb.append(sr); } } - sb.append(']'); return sb.toString(); } } diff -r 4b97847d0b2d -r 6150555eb41d src/org/tmatesoft/hg/repo/HgManifest.java --- a/src/org/tmatesoft/hg/repo/HgManifest.java Mon Feb 13 13:20:06 2012 +0100 +++ b/src/org/tmatesoft/hg/repo/HgManifest.java Mon Feb 13 14:19:36 2012 +0100 @@ -479,7 +479,12 @@ Nodeid manifest = repo.getChangelog().range(u, u).get(0).manifest(); // FIXME calculate those missing effectively (e.g. cache and sort nodeids to speed lookup // right away in the #next (may refactor ParentWalker's sequential and sorted into dedicated helper and reuse here) - changelog2manifest[u] = repo.getManifest().getRevisionIndex(manifest); + if (manifest.isNull()) { + repo.getContext().getLog().warn(getClass(), "Changeset %d has no associated manifest entry", u); + // keep -1 in the changelog2manifest map. FIXME rest of the code shall accomodate to the fact manifest revision may be missing + } else { + changelog2manifest[u] = repo.getManifest().getRevisionIndex(manifest); + } } catch (HgInvalidControlFileException ex) { // FIXME need to propagate the error up to client repo.getContext().getLog().error(getClass(), ex, null); diff -r 4b97847d0b2d -r 6150555eb41d src/org/tmatesoft/hg/repo/Revlog.java --- a/src/org/tmatesoft/hg/repo/Revlog.java Mon Feb 13 13:20:06 2012 +0100 +++ b/src/org/tmatesoft/hg/repo/Revlog.java Mon Feb 13 14:19:36 2012 +0100 @@ -140,7 +140,7 @@ public final int getRevisionIndex(Nodeid nid) throws HgInvalidControlFileException, HgInvalidRevisionException { int revision = content.findRevisionIndex(nid); if (revision == BAD_REVISION) { - throw new HgInvalidRevisionException(String.format("Bad revision of %s", this /*XXX HgDataFile.getPath might be more suitable here*/), nid, null); + throw new HgInvalidRevisionException(String.format("Can't find revision %s in %s", nid.shortNotation(), this /*FIXME HgDataFile.getPath might be more suitable here*/), nid, null); } return revision; }