Mercurial > jhg
comparison src/com/tmate/hgkit/ll/HgBundle.java @ 43:1b26247d7367
Calculate result length of the patch operarion, when unknown
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Fri, 14 Jan 2011 04:41:05 +0100 |
| parents | 92c3d0920d58 |
| children | 70dafe20931d |
comparison
equal
deleted
inserted
replaced
| 42:92c3d0920d58 | 43:1b26247d7367 |
|---|---|
| 43 // BundleFormat wiki says: | 43 // BundleFormat wiki says: |
| 44 // Each Changelog entry patches the result of all previous patches | 44 // Each Changelog entry patches the result of all previous patches |
| 45 // (the previous, or parent patch of a given patch p is the patch that has a node equal to p's p1 field) | 45 // (the previous, or parent patch of a given patch p is the patch that has a node equal to p's p1 field) |
| 46 byte[] baseRevContent = hgRepo.getChangelog().content(base); | 46 byte[] baseRevContent = hgRepo.getChangelog().content(base); |
| 47 for (GroupElement ge : changelogGroup) { | 47 for (GroupElement ge : changelogGroup) { |
| 48 int resultLen = 10000; // XXX calculate based on baseRevContent.length and ge.patches | 48 byte[] csetContent = RevlogStream.apply(baseRevContent, -1, ge.patches); |
| 49 byte[] csetContent = RevlogStream.apply(baseRevContent, resultLen, ge.patches); | |
| 50 // wiki suggests sha1_digest(min(p1,p2) ++ max(p1,p2) ++ final_text), | 49 // wiki suggests sha1_digest(min(p1,p2) ++ max(p1,p2) ++ final_text), |
| 51 dh = dh.sha1(ge.firstParent(), ge.secondParent(), csetContent); // XXX ge may give me access to byte[] content of nodeid directly, perhaps, I don't need DH to be friend of Nodeid? | 50 dh = dh.sha1(ge.firstParent(), ge.secondParent(), csetContent); // XXX ge may give me access to byte[] content of nodeid directly, perhaps, I don't need DH to be friend of Nodeid? |
| 52 if (!ge.node().equalsTo(dh.asBinary())) { | 51 if (!ge.node().equalsTo(dh.asBinary())) { |
| 53 throw new IllegalStateException("Integrity check failed on " + bundleFile + ", node:" + ge.node()); | 52 throw new IllegalStateException("Integrity check failed on " + bundleFile + ", node:" + ge.node()); |
| 54 } | 53 } |
