当前位置: 首页>>代码示例>>Java>>正文


Java GitConfigUtil.getCommitEncoding方法代码示例

本文整理汇总了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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:GitCheckinEnvironment.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:GitCheckinEnvironment.java

示例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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:GitRebaseUnstructuredEditor.java

示例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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:29,代码来源:GitCheckinEnvironment.java


注:本文中的git4idea.config.GitConfigUtil.getCommitEncoding方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。