Package org.eclipse.jgit.api

Examples of org.eclipse.jgit.api.BlameCommand


      if (StringUtils.isEmpty(objectId)) {
        object = JGitUtils.getDefaultBranch(repository);
      } else {
        object = repository.resolve(objectId);
      }
      BlameCommand blameCommand = new BlameCommand(repository);
      blameCommand.setFilePath(blobPath);
      blameCommand.setStartCommit(object);
      BlameResult blameResult = blameCommand.call();
      RawText rawText = blameResult.getResultContents();
      int length = rawText.size();
      for (int i = 0; i < length; i++) {
        RevCommit commit = blameResult.getSourceCommit(i);
        AnnotatedLine line = new AnnotatedLine(commit, i + 1, rawText.getString(i));
View Full Code Here


    String filePath = blame.getFilePath();

    if (db != null && filePath != null) {

      BlameCommand blameCommand = new BlameCommand(db);
      blameCommand.setFilePath(filePath);
      blameCommand.setFollowFileRenames(true);
      blameCommand.setTextComparator(RawTextComparator.WS_IGNORE_ALL);

      if (blame.getStartCommit() != null) {
        blameCommand.setStartCommit(blame.getStartCommit());
      }
      BlameResult result;

      try {
        result = blameCommand.call();
      } catch (Exception e1) {
        return;
      }
      if (result != null) {
        blame.clearLines();
View Full Code Here

  }

  public void execute(IProgressMonitor monitor) throws CoreException {
    final RevisionInformation info = new RevisionInformation();

    final BlameCommand command = new BlameCommand(repository)
        .setFollowFileRenames(true).setFilePath(path);
    if (startCommit != null)
      command.setStartCommit(startCommit);
    else {
      try {
        command.setStartCommit(repository.resolve(Constants.HEAD));
      } catch (IOException e) {
        Activator
            .error("Error resolving HEAD for showing annotations in repository: " + repository, e); //$NON-NLS-1$
        return;
      }
    }
    if (Activator.getDefault().getPreferenceStore()
        .getBoolean(UIPreferences.BLAME_IGNORE_WHITESPACE))
      command.setTextComparator(RawTextComparator.WS_IGNORE_ALL);

    BlameResult result;
    try {
      result = command.call();
    } catch (Exception e1) {
      Activator.error(e1.getMessage(), e1);
      return;
    }
    if (result == null)
View Full Code Here

    public static void main(String[] args) throws IOException, GitAPIException {
        // prepare a new test-repository
        Repository repository = CookbookHelper.openJGitCookbookRepository();

        BlameCommand blamer = new BlameCommand(repository);
        ObjectId commitID = repository.resolve("HEAD");
        blamer.setStartCommit(commitID);
        blamer.setFilePath("README.md");
        BlameResult blame = blamer.call();

        // read the number of lines from the commit to not look at changes in the working copy
        int lines = countFiles(repository, commitID, "README.md");
        for (int i = 0; i < lines; i++) {
            RevCommit commit = blame.getSourceCommit(i);
View Full Code Here

TOP

Related Classes of org.eclipse.jgit.api.BlameCommand

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.