mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Hg encoding fix for commit
Don't pass "--encoding" to the commit command. Default encoding is fine: it is cp1251/UTF-8 for Win/Unix or HGENCODING if it is set: being set for IDEA it is inherited by the hg process spawned by IDEA. Together with 7eab3d8f8f it fixes IDEA-67158. Remove redundant HgEncodingUtil.getDefaultCharsetName Add javadocs and @NotNulls
This commit is contained in:
committed by
Kirill Likhodedov
parent
8e6b093342
commit
d9f7cdb521
@@ -66,8 +66,6 @@ public class HgCommitCommand {
|
||||
for (HgFile hgFile : myFiles) {
|
||||
parameters.add(hgFile.getRelativePath());
|
||||
}
|
||||
parameters.add("--encoding");
|
||||
parameters.add(HgEncodingUtil.getDefaultCharsetName());
|
||||
|
||||
ensureSuccess(new HgCommandExecutor(myProject).executeInCurrentThread(myRoot, "commit", parameters));
|
||||
final MessageBus messageBus = myProject.getMessageBus();
|
||||
|
||||
@@ -16,14 +16,19 @@ public class HgEncodingUtil {
|
||||
private HgEncodingUtil() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default charset for Mercurial.
|
||||
* It is cp1251 for Windows, and UTF-8 for Unix-like systems.
|
||||
* The {@code HGENCODING} environment variable is not considered, because being set for IDEA it is inherited by the hg process
|
||||
* spawned by IDEA.
|
||||
* @return cp1251 for windows / UTF-8 for Unix-like systems.
|
||||
*/
|
||||
@NotNull
|
||||
public static Charset getDefaultCharset() {
|
||||
return SystemInfo.isWindows ? getCharsetForNameOrDefault(WINDOWS_DEFAULT_CHARSET) : getCharsetForNameOrDefault(UNIX_DEFAULT_CHARSET);
|
||||
}
|
||||
|
||||
public static String getDefaultCharsetName() {
|
||||
return SystemInfo.isWindows ? WINDOWS_DEFAULT_CHARSET : UNIX_DEFAULT_CHARSET;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static Charset getCharsetForNameOrDefault(@NotNull String name) {
|
||||
try {
|
||||
return Charset.forName(name);
|
||||
@@ -32,5 +37,4 @@ public class HgEncodingUtil {
|
||||
return Charset.defaultCharset();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user