diff 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
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/RevlogStreamWriter.java	Wed Jan 23 19:14:15 2013 +0100
+++ b/src/org/tmatesoft/hg/internal/RevlogStreamWriter.java	Wed Jan 30 15:48:36 2013 +0100
@@ -113,6 +113,23 @@
 		}
 	}
 	
-	public void addRevision(String text, int baseRevision, int linkRevision, int p1, int p2) {
+	
+	private final DigestHelper dh = new DigestHelper();
+	
+	public void addRevision(byte[] content, int linkRevision, int p1, int p2) {
+		Nodeid p1Rev = parent(p1);
+		Nodeid p2Rev = parent(p2);
+		byte[] revisionBytes = dh.sha1(p1Rev, p2Rev, content).asBinary();
+		//final Nodeid revision = Nodeid.fromBinary(revisionBytes, 0);
+		// cache last revision (its delta and baseRev)
+		PatchGenerator pg = new PatchGenerator();
+		byte[] prev = null;
+		Patch patch = pg.delta(prev, content);
+		byte[] patchContent;
+		// rest as in HgCloneCommand
+	}
+	
+	private Nodeid parent(int parentIndex) {
+		return null;
 	}
 }