本文整理汇总了Java中git4idea.config.GitConfigUtil.getCommitEncoding方法的典型用法代码示例。如果您正苦于以下问题:Java GitConfigUtil.getCommitEncoding方法的具体用法?Java GitConfigUtil.getCommitEncoding怎么用?Java GitConfigUtil.getCommitEncoding使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类git4idea.config.GitConfigUtil
的用法示例。
在下文中一共展示了GitConfigUtil.getCommitEncoding方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDefaultMessageFor
import git4idea.config.GitConfigUtil; //导入方法依赖的package包/类
@Nullable
public String getDefaultMessageFor(FilePath[] filesToCheckin) {
LinkedHashSet<String> messages = ContainerUtil.newLinkedHashSet();
for (VirtualFile root : GitUtil.gitRoots(Arrays.asList(filesToCheckin))) {
VirtualFile mergeMsg = root.findFileByRelativePath(GitRepositoryFiles.GIT_MERGE_MSG);
VirtualFile squashMsg = root.findFileByRelativePath(GitRepositoryFiles.GIT_SQUASH_MSG);
try {
if (mergeMsg == null && squashMsg == null) {
continue;
}
String encoding = GitConfigUtil.getCommitEncoding(myProject, root);
if (mergeMsg != null) {
messages.add(loadMessage(mergeMsg, encoding));
}
else {
messages.add(loadMessage(squashMsg, encoding));
}
}
catch (IOException e) {
if (log.isDebugEnabled()) {
log.debug("Unable to load merge message", e);
}
}
}
return DvcsUtil.joinMessagesOrNull(messages);
}
示例2: createMessageFile
import git4idea.config.GitConfigUtil; //导入方法依赖的package包/类
/**
* Create a file that contains the specified message
*
* @param root a git repository root
* @param message a message to write
* @return a file reference
* @throws IOException if file cannot be created
*/
private File createMessageFile(VirtualFile root, final String message) throws IOException {
// filter comment lines
File file = FileUtil.createTempFile(GIT_COMMIT_MSG_FILE_PREFIX, GIT_COMMIT_MSG_FILE_EXT);
file.deleteOnExit();
@NonNls String encoding = GitConfigUtil.getCommitEncoding(myProject, root);
Writer out = new OutputStreamWriter(new FileOutputStream(file), encoding);
try {
out.write(message);
}
finally {
out.close();
}
return file;
}
示例3: GitRebaseUnstructuredEditor
import git4idea.config.GitConfigUtil; //导入方法依赖的package包/类
/**
* The constructor
*
* @param project the context project
* @param root the Git root
* @param path the path to edit
* @throws IOException if there is an IO problem
*/
protected GitRebaseUnstructuredEditor(Project project, VirtualFile root, String path) throws IOException {
super(project, true);
setTitle(GitBundle.message("rebase.unstructured.editor.title"));
setOKButtonText(GitBundle.message("rebase.unstructured.editor.button"));
myGitRootLabel.setText(root.getPresentableUrl());
encoding = GitConfigUtil.getCommitEncoding(project, root);
myFile = new File(path);
myTextArea.setText(FileUtil.loadFile(myFile, encoding));
myTextArea.setCaretPosition(0);
init();
}
示例4: getDefaultMessageFor
import git4idea.config.GitConfigUtil; //导入方法依赖的package包/类
@Nullable
public String getDefaultMessageFor(FilePath[] filesToCheckin) {
StringBuilder rc = new StringBuilder();
for (VirtualFile root : GitUtil.gitRoots(Arrays.asList(filesToCheckin))) {
VirtualFile mergeMsg = root.findFileByRelativePath(GitRepositoryFiles.GIT_MERGE_MSG);
VirtualFile squashMsg = root.findFileByRelativePath(GitRepositoryFiles.GIT_SQUASH_MSG);
if (mergeMsg != null || squashMsg != null) {
try {
String encoding = GitConfigUtil.getCommitEncoding(myProject, root);
if (mergeMsg != null) {
rc.append(FileUtil.loadFileText(new File(mergeMsg.getPath()), encoding));
}
if (squashMsg != null) {
rc.append(FileUtil.loadFileText(new File(squashMsg.getPath()), encoding));
}
}
catch (IOException e) {
if (log.isDebugEnabled()) {
log.debug("Unable to load merge message", e);
}
}
}
}
if (rc.length() != 0) {
return rc.toString();
}
return null;
}