diff src/org/tmatesoft/hg/internal/StoragePathHelper.java @ 292:a415fe296a50

Refactor PathRewrite to accept any char sequence, not only string
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 14 Sep 2011 02:16:19 +0200
parents bb1d02f9eff6
children 6d2c6b2469fc
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/StoragePathHelper.java	Wed Sep 14 02:12:47 2011 +0200
+++ b/src/org/tmatesoft/hg/internal/StoragePathHelper.java	Wed Sep 14 02:16:19 2011 +0200
@@ -43,13 +43,14 @@
 	// FIXME document what path argument is, whether it includes .i or .d, and whether it's 'normalized' (slashes) or not.
 	// since .hg/store keeps both .i files and files without extension (e.g. fncache), guees, for data == false 
 	// we shall assume path has extension
-	public String rewrite(String path) {
+	public CharSequence rewrite(CharSequence p) {
 		final String STR_STORE = "store/";
 		final String STR_DATA = "data/";
 		final String STR_DH = "dh/";
 		final String reservedChars = "\\:*?\"<>|";
 		char[] hexByte = new char[2];
 		
+		String path = p.toString();
 		path = path.replace(".hg/", ".hg.hg/").replace(".i/", ".i.hg/").replace(".d/", ".d.hg/");
 		StringBuilder sb = new StringBuilder(path.length() << 1);
 		if (store || fncache) {