comparison src/org/tmatesoft/hg/internal/RevlogStreamWriter.java @ 533:e6f72c9829a6

Generate patches using diff algorithm
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 30 Jan 2013 15:48:36 +0100
parents 688c1ab113bb
children 243202f1bda5
comparison
equal deleted inserted replaced
532:688c1ab113bb 533:e6f72c9829a6
111 // (while offset in the index file with inline==true differs by n*sizeof(header), where n is entry's position in the file) 111 // (while offset in the index file with inline==true differs by n*sizeof(header), where n is entry's position in the file)
112 offset += compressedLength; 112 offset += compressedLength;
113 } 113 }
114 } 114 }
115 115
116 public void addRevision(String text, int baseRevision, int linkRevision, int p1, int p2) { 116
117 private final DigestHelper dh = new DigestHelper();
118
119 public void addRevision(byte[] content, int linkRevision, int p1, int p2) {
120 Nodeid p1Rev = parent(p1);
121 Nodeid p2Rev = parent(p2);
122 byte[] revisionBytes = dh.sha1(p1Rev, p2Rev, content).asBinary();
123 //final Nodeid revision = Nodeid.fromBinary(revisionBytes, 0);
124 // cache last revision (its delta and baseRev)
125 PatchGenerator pg = new PatchGenerator();
126 byte[] prev = null;
127 Patch patch = pg.delta(prev, content);
128 byte[] patchContent;
129 // rest as in HgCloneCommand
130 }
131
132 private Nodeid parent(int parentIndex) {
133 return null;
117 } 134 }
118 } 135 }