use of org.zmlx.hg4idea.log.HgFileRevisionLogParser in project intellij-community by JetBrains.
the class HgLogCommand method execute.
/**
* @param limit Pass -1 to set no limits on history
*/
public final List<HgFileRevision> execute(final HgFile hgFile, int limit, boolean includeFiles, @Nullable List<String> argsForCmd) {
if ((limit <= 0 && limit != -1) || hgFile == null) {
return Collections.emptyList();
}
String[] templates = HgBaseLogParser.constructFullTemplateArgument(includeFiles, myVersion);
String template = HgChangesetUtil.makeTemplate(templates);
FilePath originalFileName = HgUtil.getOriginalFileName(hgFile.toFilePath(), ChangeListManager.getInstance(myProject));
HgFile originalHgFile = new HgFile(hgFile.getRepo(), originalFileName);
HgCommandResult result = execute(hgFile.getRepo(), template, limit, originalHgFile, argsForCmd);
return HgHistoryUtil.getCommitRecords(myProject, result, new HgFileRevisionLogParser(myProject, originalHgFile, myVersion));
}
use of org.zmlx.hg4idea.log.HgFileRevisionLogParser in project intellij-community by JetBrains.
the class HgHistoryProvider method getHistoryForUncommittedRenamed.
/**
* Workaround for getting follow file history in case of uncommitted move/rename change
*/
private static List<HgFileRevision> getHistoryForUncommittedRenamed(@NotNull FilePath originalHgFilePath, @NotNull VirtualFile vcsRoot, @NotNull Project project, int limit) {
HgFile originalHgFile = new HgFile(vcsRoot, originalHgFilePath);
final HgLogCommand logCommand = new HgLogCommand(project);
logCommand.setIncludeRemoved(true);
final HgVersion version = logCommand.getVersion();
String[] templates = HgBaseLogParser.constructFullTemplateArgument(false, version);
String template = HgChangesetUtil.makeTemplate(templates);
List<String> argsForCmd = ContainerUtil.newArrayList();
String relativePath = originalHgFile.getRelativePath();
argsForCmd.add("--rev");
argsForCmd.add(String.format("reverse(follow(%s))", relativePath != null ? "'" + FileUtil.toSystemIndependentName(relativePath) + "'" : ""));
HgCommandResult result = logCommand.execute(vcsRoot, template, limit, relativePath != null ? null : originalHgFile, argsForCmd);
return HgHistoryUtil.getCommitRecords(project, result, new HgFileRevisionLogParser(project, originalHgFile, version));
}
Aggregations