Package org.eclipse.jgit.diff

Examples of org.eclipse.jgit.diff.DiffFormatter.format()


          diffFmt.setContext(contextLines);
        if (destinationPrefix != null)
          diffFmt.setNewPrefix(destinationPrefix);
        if (sourcePrefix != null)
          diffFmt.setOldPrefix(sourcePrefix);
        diffFmt.format(result);
        diffFmt.flush();
        return result;
      }
    } catch (IOException e) {
      throw new JGitInternalException(e.getMessage(), e);
View Full Code Here


    rebaseState.createFile(AUTHOR_SCRIPT, authorScript);
    rebaseState.createFile(MESSAGE, commitToPick.getFullMessage());
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    DiffFormatter df = new DiffFormatter(bos);
    df.setRepository(repo);
    df.format(commitToPick.getParent(0), commitToPick);
    rebaseState.createFile(PATCH, new String(bos.toByteArray(),
        Constants.CHARACTER_ENCODING));
    rebaseState.createFile(STOPPED_SHA,
        repo.newObjectReader()
        .abbreviate(
View Full Code Here

          diffFmt.setContext(contextLines);
        if (destinationPrefix != null)
          diffFmt.setNewPrefix(destinationPrefix);
        if (sourcePrefix != null)
          diffFmt.setOldPrefix(sourcePrefix);
        diffFmt.format(result);
        diffFmt.flush();
        return result;
      }
    } catch (IOException e) {
      throw new JGitInternalException(e.getMessage(), e);
View Full Code Here

    createFile(rebaseDir, AUTHOR_SCRIPT, authorScript);
    createFile(rebaseDir, MESSAGE, commitToPick.getFullMessage());
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    DiffFormatter df = new DiffFormatter(bos);
    df.setRepository(repo);
    df.format(commitToPick.getParent(0), commitToPick);
    createFile(rebaseDir, PATCH, new String(bos.toByteArray(),
        Constants.CHARACTER_ENCODING));
    createFile(rebaseDir, STOPPED_SHA, repo.newObjectReader().abbreviate(
        commitToPick).name());
    // Remove cherry pick state file created by CherryPickCommand, it's not
View Full Code Here

            ByteArrayOutputStream diffOutputStream = new ByteArrayOutputStream();
            DiffFormatter diffFormatter = new DiffFormatter(diffOutputStream);
            diffFormatter.setRepository(context.getRepository());
            diffFormatter.setDiffComparator(RawTextComparator.DEFAULT);
            diffFormatter.setDetectRenames(true);
            diffFormatter.format(parentCommit.getTree(),revCommit.getTree());
            return new String(diffOutputStream.toByteArray());
        } else {
            return null;
        }
    }
View Full Code Here

          diffFmt.setContext(contextLines);
        if (destinationPrefix != null)
          diffFmt.setNewPrefix(destinationPrefix);
        if (sourcePrefix != null)
          diffFmt.setOldPrefix(sourcePrefix);
        diffFmt.format(result);
        diffFmt.flush();
        return result;
      }
    } catch (IOException e) {
      throw new JGitInternalException(e.getMessage(), e);
View Full Code Here

    createFile(rebaseDir, AUTHOR_SCRIPT, authorScript);
    createFile(rebaseDir, MESSAGE, commitToPick.getFullMessage());
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    DiffFormatter df = new DiffFormatter(bos);
    df.setRepository(repo);
    df.format(commitToPick.getParent(0), commitToPick);
    createFile(rebaseDir, PATCH, new String(bos.toByteArray(),
        Constants.CHARACTER_ENCODING));
    createFile(rebaseDir, STOPPED_SHA, repo.newObjectReader().abbreviate(
        commitToPick).name());
    // Remove cherry pick state file created by CherryPickCommand, it's not
View Full Code Here

          if (ChangeType.DELETE.equals(ent.getChangeType()))
            path = ent.getOldPath();
          else
            path = ent.getNewPath();
          currentEncoding = CompareCoreUtils.getResourceEncoding(repository, path);
          diffFmt.format(ent);
        }
      } else
        diffFmt.format(
            new DirCacheIterator(repository.readDirCache()),
            new FileTreeIterator(repository));
View Full Code Here

            path = ent.getNewPath();
          currentEncoding = CompareCoreUtils.getResourceEncoding(repository, path);
          diffFmt.format(ent);
        }
      } else
        diffFmt.format(
            new DirCacheIterator(repository.readDirCache()),
            new FileTreeIterator(repository));
    } catch (IOException e) {
      Activator.logError(CoreText.CreatePatchOperation_patchFileCouldNotBeWritten, e);
    }
View Full Code Here

                                   Repository repository ) throws IOException {
        ByteArrayOutputStream output = new ByteArrayOutputStream();
        DiffFormatter formatter = new DiffFormatter(output);
        formatter.setRepository(repository);
        for (DiffEntry entry : entries) {
            formatter.format(entry);
        }
        return output.toString(DIFF_CHARSET_NAME);
    }

}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.