/**
  * Create intent to show file in commit
  *
  * @param repository
  * @param commit
  * @param file
  * @return intent
  */
 public static Intent createIntent(Repository repository, String commit, CommitFile file) {
   Builder builder = new Builder("commit.file.VIEW");
   builder.repo(repository);
   builder.add(EXTRA_HEAD, commit);
   builder.add(EXTRA_PATH, file.getFilename());
   builder.add(EXTRA_BASE, file.getSha());
   return builder.toIntent();
 }
  @Override
  public int compare(final CommitFile lhs, final CommitFile rhs) {
    String lPath = lhs.getFilename();
    final int lSlash = lPath.lastIndexOf('/');
    if (lSlash != -1) lPath = lPath.substring(lSlash + 1);

    String rPath = rhs.getFilename();
    final int rSlash = rPath.lastIndexOf('/');
    if (rSlash != -1) rPath = rPath.substring(rSlash + 1);

    return lPath.compareTo(rPath);
  }
  /**
   * Set files to styler
   *
   * @param files
   * @return this styler
   */
  public DiffStyler setFiles(final Collection<CommitFile> files) {
    diffs.clear();
    if (files == null || files.isEmpty()) return this;

    for (CommitFile file : files) {
      String patch = file.getPatch();
      if (TextUtils.isEmpty(patch)) continue;

      int start = 0;
      int length = patch.length();
      int end = nextLine(patch, start, length);
      List<CharSequence> lines = new ArrayList<CharSequence>();
      while (start < length) {
        lines.add(patch.substring(start, end));
        start = end + 1;
        end = nextLine(patch, start, length);
      }
      diffs.put(file.getFilename(), lines);
    }
    return this;
  }