comparison src/org/tmatesoft/hg/internal/RevlogStreamWriter.java @ 544:7f5998a9619d

Refactor PatchGenerator to be generic and welcome sequence of any nature
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 15 Feb 2013 16:48:54 +0100
parents 9edfd5a223b8
children e447384f3771
comparison
equal deleted inserted replaced
543:1e95f48d9886 544:7f5998a9619d
59 lastEntryRevision = Nodeid.NULL; 59 lastEntryRevision = Nodeid.NULL;
60 int revCount = revlogStream.revisionCount(); 60 int revCount = revlogStream.revisionCount();
61 lastEntryIndex = revCount == 0 ? NO_REVISION : revCount - 1; 61 lastEntryIndex = revCount == 0 ? NO_REVISION : revCount - 1;
62 populateLastEntry(); 62 populateLastEntry();
63 // 63 //
64 PatchGenerator pg = new PatchGenerator(); 64 Patch patch = GeneratePatchInspector.delta(lastEntryContent, content);
65 Patch patch = pg.delta(lastEntryContent, content);
66 int patchSerializedLength = patch.serializedLength(); 65 int patchSerializedLength = patch.serializedLength();
67 66
68 final boolean writeComplete = preferCompleteOverPatch(patchSerializedLength, content.length); 67 final boolean writeComplete = preferCompleteOverPatch(patchSerializedLength, content.length);
69 DataSerializer.DataSource dataSource = writeComplete ? new DataSerializer.ByteArrayDataSource(content) : patch.new PatchDataSource(); 68 DataSerializer.DataSource dataSource = writeComplete ? new DataSerializer.ByteArrayDataSource(content) : patch.new PatchDataSource();
70 revlogDataZip.reset(dataSource); 69 revlogDataZip.reset(dataSource);