Mercurial > jhg
comparison src/com/tmate/hgkit/ll/HgBundle.java @ 51:9429c7bd1920 wrap-data-access
Try DataAccess to reach revision data instead of plain byte arrays
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Sun, 16 Jan 2011 01:20:26 +0100 |
| parents | b01500fe2604 |
| children |
comparison
equal
deleted
inserted
replaced
| 50:f1db8610da62 | 51:9429c7bd1920 |
|---|---|
| 6 import java.io.File; | 6 import java.io.File; |
| 7 import java.io.IOException; | 7 import java.io.IOException; |
| 8 import java.util.LinkedList; | 8 import java.util.LinkedList; |
| 9 import java.util.List; | 9 import java.util.List; |
| 10 | 10 |
| 11 import com.tmate.hgkit.fs.ByteArrayDataAccess; | |
| 11 import com.tmate.hgkit.fs.DataAccess; | 12 import com.tmate.hgkit.fs.DataAccess; |
| 12 import com.tmate.hgkit.fs.DataAccessProvider; | 13 import com.tmate.hgkit.fs.DataAccessProvider; |
| 13 | 14 |
| 14 /** | 15 /** |
| 15 * @see http://mercurial.selenic.com/wiki/BundleFormat | 16 * @see http://mercurial.selenic.com/wiki/BundleFormat |
| 43 // BundleFormat wiki says: | 44 // BundleFormat wiki says: |
| 44 // Each Changelog entry patches the result of all previous patches | 45 // 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) | 46 // (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); | 47 byte[] baseRevContent = hgRepo.getChangelog().content(base); |
| 47 for (GroupElement ge : changelogGroup) { | 48 for (GroupElement ge : changelogGroup) { |
| 48 byte[] csetContent = RevlogStream.apply(baseRevContent, -1, ge.patches); | 49 byte[] csetContent = RevlogStream.apply(new ByteArrayDataAccess(baseRevContent), -1, ge.patches); |
| 49 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? |
| 50 if (!ge.node().equalsTo(dh.asBinary())) { | 51 if (!ge.node().equalsTo(dh.asBinary())) { |
| 51 throw new IllegalStateException("Integrity check failed on " + bundleFile + ", node:" + ge.node()); | 52 throw new IllegalStateException("Integrity check failed on " + bundleFile + ", node:" + ge.node()); |
| 52 } | 53 } |
| 53 Changeset cs = Changeset.parse(csetContent, 0, csetContent.length); | 54 Changeset cs = Changeset.parse(csetContent, 0, csetContent.length); |
