Mercurial > jhg
comparison src/org/tmatesoft/hg/internal/BundleGenerator.java @ 670:52af7f62e731
AIOOBE in BundleGenerator.ChunkGenerator.iterate when there are no outgoing changes on push
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Fri, 12 Jul 2013 15:27:43 +0200 |
| parents | d25f0324a27a |
| children |
comparison
equal
deleted
inserted
replaced
| 669:b1a3a056d7e6 | 670:52af7f62e731 |
|---|---|
| 53 | 53 |
| 54 public BundleGenerator(Internals hgRepo) { | 54 public BundleGenerator(Internals hgRepo) { |
| 55 repo = hgRepo; | 55 repo = hgRepo; |
| 56 } | 56 } |
| 57 | 57 |
| 58 /** | |
| 59 * @return never <code>null</code>. empty file if no changesets were written | |
| 60 */ | |
| 58 public File create(List<Nodeid> changesets) throws HgIOException, IOException { | 61 public File create(List<Nodeid> changesets) throws HgIOException, IOException { |
| 59 final HgChangelog clog = repo.getRepo().getChangelog(); | 62 final HgChangelog clog = repo.getRepo().getChangelog(); |
| 60 final HgManifest manifest = repo.getRepo().getManifest(); | 63 final HgManifest manifest = repo.getRepo().getManifest(); |
| 61 IntVector clogRevsVector = new IntVector(changesets.size(), 0); | 64 IntVector clogRevsVector = new IntVector(changesets.size(), 0); |
| 62 for (Nodeid n : changesets) { | 65 for (Nodeid n : changesets) { |
| 83 } | 86 } |
| 84 }, clogRevs); | 87 }, clogRevs); |
| 85 manifestRevs.sort(true); | 88 manifestRevs.sort(true); |
| 86 // | 89 // |
| 87 final File bundleFile = File.createTempFile("hg4j-", ".bundle"); | 90 final File bundleFile = File.createTempFile("hg4j-", ".bundle"); |
| 91 if (clogRevs.length == 0) { | |
| 92 // nothing to write | |
| 93 return bundleFile; | |
| 94 } | |
| 88 final FileOutputStream osBundle = new FileOutputStream(bundleFile); | 95 final FileOutputStream osBundle = new FileOutputStream(bundleFile); |
| 89 final OutputStreamSerializer outRaw = new OutputStreamSerializer(osBundle); | 96 final OutputStreamSerializer outRaw = new OutputStreamSerializer(osBundle); |
| 90 outRaw.write("HG10UN".getBytes(), 0, 6); | 97 outRaw.write("HG10UN".getBytes(), 0, 6); |
| 91 // | 98 // |
| 92 RevlogStream clogStream = repo.getImplAccess().getChangelogStream(); | 99 RevlogStream clogStream = repo.getImplAccess().getChangelogStream(); |
