diff src/org/tmatesoft/hg/internal/BundleGenerator.java @ 667:fba85bc1dfb8

Refactoring: move all encoding/decoding operations into single place, EncodingHelper
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Thu, 11 Jul 2013 17:54:08 +0200
parents 6e98d34eaca8
children d25f0324a27a
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/BundleGenerator.java	Wed Jul 10 20:22:07 2013 +0200
+++ b/src/org/tmatesoft/hg/internal/BundleGenerator.java	Thu Jul 11 17:54:08 2013 +0200
@@ -101,6 +101,7 @@
 		new ChunkGenerator(outRaw, clogMap).iterate(manifestStream, manifestRevs.toArray(true));
 		outRaw.writeInt(0); // null chunk for manifest group
 		//
+		EncodingHelper fnEncoder = repo.buildFileNameEncodingHelper();
 		for (HgDataFile df : sortedByName(files)) {
 			RevlogStream s = repo.getImplAccess().getStream(df);
 			final IntVector fileRevs = new IntVector();
@@ -117,7 +118,7 @@
 				// although BundleFormat page says "filename length, filename" for a file,
 				// in fact there's a sort of 'filename chunk', i.e. filename length field includes
 				// not only length of filename, but also length of the field itseld, i.e. filename.length+sizeof(int)
-				byte[] fnameBytes = df.getPath().toString().getBytes(); // FIXME check encoding in native hg (and fix accordingly in HgBundle)
+				byte[] fnameBytes = fnEncoder.toBundle(df.getPath());
 				outRaw.writeInt(fnameBytes.length + 4);
 				outRaw.writeByte(fnameBytes);
 				new ChunkGenerator(outRaw, clogMap).iterate(s, fileRevs.toArray(true));