Mercurial > hg4j
changeset 385:6150555eb41d
HgInvalidRevisionException for svn imported repositories (changeset 0 references nullid manifest)
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Mon, 13 Feb 2012 14:19:36 +0100 |
parents | 4b97847d0b2d |
children | 73e875154afb |
files | src/org/tmatesoft/hg/core/HgInvalidRevisionException.java src/org/tmatesoft/hg/repo/HgManifest.java src/org/tmatesoft/hg/repo/Revlog.java |
diffstat | 3 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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(); } }
--- 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);
--- 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; }