# HG changeset patch # User Artem Tikhomirov # Date 1302742086 -7200 # Node ID 9b99d27aeddc3d516b26f7fccb0b306edc55a7f1 # Parent e9d275fb0bc0e9d4068f721a2cf333e61c378de1 More debug printouts diff -r e9d275fb0bc0 -r 9b99d27aeddc cmdline/org/tmatesoft/hg/console/Bundle.java --- a/cmdline/org/tmatesoft/hg/console/Bundle.java Thu Apr 14 02:47:47 2011 +0200 +++ b/cmdline/org/tmatesoft/hg/console/Bundle.java Thu Apr 14 02:48:06 2011 +0200 @@ -40,9 +40,12 @@ System.err.printf("Can't find repository in: %s\n", hgRepo.getLocation()); return; } - File bundleFile = new File("/temp/hg/hg-bundle-a78c980749e3.tmp"); + File bundleFile = new File("/temp/hg/hg-bundle-cpython.tmp"); HgBundle hgBundle = new HgLookup().loadBundle(bundleFile); -// hgBundle.dump(); + hgBundle.inspectFiles(new HgBundle.Dump()); + if (Boolean.parseBoolean("true")) { + return; + } /* pass -R , e.g. for bundle with tip=168 and -R \temp\hg4j-50 with tip:159 +Changeset {User: ..., Comment: Integer ....} +Changeset {User: ..., Comment: Approach with ...} diff -r e9d275fb0bc0 -r 9b99d27aeddc src/org/tmatesoft/hg/core/HgCloneCommand.java --- a/src/org/tmatesoft/hg/core/HgCloneCommand.java Thu Apr 14 02:47:47 2011 +0200 +++ b/src/org/tmatesoft/hg/core/HgCloneCommand.java Thu Apr 14 02:48:06 2011 +0200 @@ -109,8 +109,9 @@ // 3. process every file, using map from 3, and consult set from step 4 to ensure repo is correct private static class WriteDownMate implements HgBundle.Inspector { private final File hgDir; + private final PathRewrite storagePathHelper; private FileOutputStream indexFile; - private final PathRewrite storagePathHelper; + private String filename; // human-readable name of the file being written, for log/exception purposes private final TreeMap changelogIndexes = new TreeMap(); private boolean collectChangelogIndexes = false; @@ -152,7 +153,7 @@ base = -1; offset = 0; revisionSequence.clear(); - indexFile = new FileOutputStream(new File(hgDir, "store/00changelog.i")); + indexFile = new FileOutputStream(new File(hgDir, filename = "store/00changelog.i")); collectChangelogIndexes = true; } catch (IOException ex) { throw new HgBadStateException(ex); @@ -168,6 +169,7 @@ collectChangelogIndexes = false; indexFile.close(); indexFile = null; + filename = null; } catch (IOException ex) { throw new HgBadStateException(ex); } @@ -178,7 +180,7 @@ base = -1; offset = 0; revisionSequence.clear(); - indexFile = new FileOutputStream(new File(hgDir, "store/00manifest.i")); + indexFile = new FileOutputStream(new File(hgDir, filename = "store/00manifest.i")); } catch (IOException ex) { throw new HgBadStateException(ex); } @@ -192,6 +194,7 @@ } indexFile.close(); indexFile = null; + filename = null; } catch (IOException ex) { throw new HgBadStateException(ex); } @@ -204,7 +207,7 @@ revisionSequence.clear(); fncacheFiles.add("data/" + name + ".i"); // FIXME this is pure guess, // need to investigate more how filenames are kept in fncache - File file = new File(hgDir, storagePathHelper.rewrite(name)); + File file = new File(hgDir, filename = storagePathHelper.rewrite(name)); file.getParentFile().mkdirs(); indexFile = new FileOutputStream(file); } catch (IOException ex) { @@ -220,6 +223,7 @@ } indexFile.close(); indexFile = null; + filename = null; } catch (IOException ex) { throw new HgBadStateException(ex); } @@ -235,7 +239,7 @@ } } } - throw new HgBadStateException(String.format("Can't find index of %s", p.shortNotation())); + throw new HgBadStateException(String.format("Can't find index of %s for file %s", p.shortNotation(), filename)); } public boolean element(GroupElement ge) { @@ -252,7 +256,7 @@ byte[] calculated = dh.sha1(p1, p2, content).asBinary(); final Nodeid node = ge.node(); if (!node.equalsTo(calculated)) { - throw new HgBadStateException("Checksum failed"); + throw new HgBadStateException(String.format("Checksum failed: expected %s, calculated %s. File %s", node, calculated, filename)); } final int link; if (collectChangelogIndexes) { @@ -261,7 +265,7 @@ } else { Integer csRev = changelogIndexes.get(ge.cset()); if (csRev == null) { - throw new HgBadStateException(String.format("Changelog doesn't contain revision %s", ge.cset().shortNotation())); + throw new HgBadStateException(String.format("Changelog doesn't contain revision %s of %s", ge.cset().shortNotation(), filename)); } link = csRev.intValue(); } diff -r e9d275fb0bc0 -r 9b99d27aeddc src/org/tmatesoft/hg/repo/HgRemoteRepository.java --- a/src/org/tmatesoft/hg/repo/HgRemoteRepository.java Thu Apr 14 02:47:47 2011 +0200 +++ b/src/org/tmatesoft/hg/repo/HgRemoteRepository.java Thu Apr 14 02:48:06 2011 +0200 @@ -334,6 +334,9 @@ dumpResponseHeader(u, c); } File tf = writeBundle(c.getInputStream(), false, "HG10GZ" /*didn't see any other that zip*/); + if (debug) { + System.out.printf("Wrote bundle %s for roots %s", tf, sb); + } return getLookupHelper().loadBundle(tf); } catch (MalformedURLException ex) { throw new HgException(ex);