/** * Enable or disable rename detection. * * Before enabling rename detection the repository must be set with * {@link #setRepository(Repository)}. Once enabled the detector can be * configured away from its defaults by obtaining the instance directly from * {@link #getRenameDetector()} and invoking configuration. * * @param on * if rename detection should be enabled. */ public void setDetectRenames(boolean on) { if (on && renameDetector == null) { assertHaveReader(); renameDetector = new RenameDetector(reader, diffCfg); } else if (!on) renameDetector = null; }
/** * Determine the differences between two trees. * * No output is created, instead only the file paths that are different are * returned. Callers may choose to format these paths themselves, or convert * them into {@link org.eclipse.jgit.patch.FileHeader} instances with a * complete edit list by calling {@link #toFileHeader(DiffEntry)}. * <p> * Either side may be null to indicate that the tree has beed added or * removed. The diff will be computed against nothing. * * @param a * the old (or previous) side or null * @param b * the new (or updated) side or null * @return the paths that are different. * @throws java.io.IOException * trees cannot be read or file contents cannot be read. */ public List<DiffEntry> scan(RevTree a, RevTree b) throws IOException { assertHaveReader(); AbstractTreeIterator aIterator = makeIteratorFromTreeOrNull(a); AbstractTreeIterator bIterator = makeIteratorFromTreeOrNull(b); return scan(aIterator, bIterator); }
/** * Determine the differences between two trees. * * No output is created, instead only the file paths that are different are * returned. Callers may choose to format these paths themselves, or convert * them into {@link org.eclipse.jgit.patch.FileHeader} instances with a * complete edit list by calling {@link #toFileHeader(DiffEntry)}. * <p> * Either side may be null to indicate that the tree has beed added or * removed. The diff will be computed against nothing. * * @param a * the old (or previous) side or null * @param b * the new (or updated) side or null * @return the paths that are different. * @throws java.io.IOException * trees cannot be read or file contents cannot be read. */ public List<DiffEntry> scan(AnyObjectId a, AnyObjectId b) throws IOException { assertHaveReader(); try (RevWalk rw = new RevWalk(reader)) { RevTree aTree = a != null ? rw.parseTree(a) : null; RevTree bTree = b != null ? rw.parseTree(b) : null; return scan(aTree, bTree); } }
/** * Enable or disable rename detection. * * Before enabling rename detection the repository must be set with * {@link #setRepository(Repository)}. Once enabled the detector can be * configured away from its defaults by obtaining the instance directly from * {@link #getRenameDetector()} and invoking configuration. * * @param on * if rename detection should be enabled. */ public void setDetectRenames(boolean on) { if (on && renameDetector == null) { assertHaveReader(); renameDetector = new RenameDetector(reader, diffCfg); } else if (!on) renameDetector = null; }
/** * Enable or disable rename detection. * * Before enabling rename detection the repository must be set with * {@link #setRepository(Repository)}. Once enabled the detector can be * configured away from its defaults by obtaining the instance directly from * {@link #getRenameDetector()} and invoking configuration. * * @param on * if rename detection should be enabled. */ public void setDetectRenames(boolean on) { if (on && renameDetector == null) { assertHaveReader(); renameDetector = new RenameDetector(reader, diffCfg); } else if (!on) renameDetector = null; }
/** * Determine the differences between two trees. * * No output is created, instead only the file paths that are different are * returned. Callers may choose to format these paths themselves, or convert * them into {@link FileHeader} instances with a complete edit list by * calling {@link #toFileHeader(DiffEntry)}. * <p> * Either side may be null to indicate that the tree has beed added or * removed. The diff will be computed against nothing. * * @param a * the old (or previous) side or null * @param b * the new (or updated) side or null * @return the paths that are different. * @throws IOException * trees cannot be read or file contents cannot be read. */ public List<DiffEntry> scan(RevTree a, RevTree b) throws IOException { assertHaveReader(); AbstractTreeIterator aIterator = makeIteratorFromTreeOrNull(a); AbstractTreeIterator bIterator = makeIteratorFromTreeOrNull(b); return scan(aIterator, bIterator); }
/** * Determine the differences between two trees. * * No output is created, instead only the file paths that are different are * returned. Callers may choose to format these paths themselves, or convert * them into {@link org.eclipse.jgit.patch.FileHeader} instances with a * complete edit list by calling {@link #toFileHeader(DiffEntry)}. * <p> * Either side may be null to indicate that the tree has beed added or * removed. The diff will be computed against nothing. * * @param a * the old (or previous) side or null * @param b * the new (or updated) side or null * @return the paths that are different. * @throws java.io.IOException * trees cannot be read or file contents cannot be read. */ public List<DiffEntry> scan(RevTree a, RevTree b) throws IOException { assertHaveReader(); AbstractTreeIterator aIterator = makeIteratorFromTreeOrNull(a); AbstractTreeIterator bIterator = makeIteratorFromTreeOrNull(b); return scan(aIterator, bIterator); }
/** * Determine the differences between two trees. * * No output is created, instead only the file paths that are different are * returned. Callers may choose to format these paths themselves, or convert * them into {@link org.eclipse.jgit.patch.FileHeader} instances with a * complete edit list by calling {@link #toFileHeader(DiffEntry)}. * <p> * Either side may be null to indicate that the tree has beed added or * removed. The diff will be computed against nothing. * * @param a * the old (or previous) side or null * @param b * the new (or updated) side or null * @return the paths that are different. * @throws java.io.IOException * trees cannot be read or file contents cannot be read. */ public List<DiffEntry> scan(AnyObjectId a, AnyObjectId b) throws IOException { assertHaveReader(); try (RevWalk rw = new RevWalk(reader)) { RevTree aTree = a != null ? rw.parseTree(a) : null; RevTree bTree = b != null ? rw.parseTree(b) : null; return scan(aTree, bTree); } }
/** * Determine the differences between two trees. * * No output is created, instead only the file paths that are different are * returned. Callers may choose to format these paths themselves, or convert * them into {@link FileHeader} instances with a complete edit list by * calling {@link #toFileHeader(DiffEntry)}. * <p> * Either side may be null to indicate that the tree has beed added or * removed. The diff will be computed against nothing. * * @param a * the old (or previous) side or null * @param b * the new (or updated) side or null * @return the paths that are different. * @throws IOException * trees cannot be read or file contents cannot be read. */ public List<DiffEntry> scan(AnyObjectId a, AnyObjectId b) throws IOException { assertHaveReader(); try (RevWalk rw = new RevWalk(reader)) { RevTree aTree = a != null ? rw.parseTree(a) : null; RevTree bTree = b != null ? rw.parseTree(b) : null; return scan(aTree, bTree); } }