File file = new File(hgDir, filename = storagePathHelper.rewrite(name).toString());
file.getParentFile().mkdirs();
indexFile = new FileOutputStream(currentFile = file);
} catch (IOException ex) {
String m = String.format("Failed to write file %s", filename);
throw new HgInvalidControlFileException(m, ex, new File(filename));
}
stopIfCancelled();
}