After instantiating, applyPatch() should be called once.
| Modifier and Type | Class and Description |
|---|---|
| private static class | PatchApplier.
Provide stream, along with the length of the object. |
| public static class | PatchApplier.
A wrapper for returning both the applied tree ID and the applied files list, as well as file specific errors. |
| private static class | PatchApplier.
An |
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private final RevTree | beforeTree
The tree before applying the patch. |
| private final Charset | |
| private static final int | |
| private int | |
| private final ObjectInserter | |
| private static final byte[] | |
| private final ObjectReader | |
| private final Repository | |
| private WorkingTreeOptions |
| Access | Constructor and Description |
|---|---|
| public | |
| public | PatchApplier(Repository
repository to apply the patch in repo, RevTree ID of the tree to apply the patch in beforeTree, ObjectInserter to be used for modifying objects oi)
|
| Modifier and Type | Method and Description |
|---|---|
| public PatchApplier | Returns: thePatchApplier to apply any patchesSets up the |
| private void | apply(String
The path to use for the pre-image. Also determines CRLF and
smudge settings. pathWithOriginalContent, DirCache Dircache to read existing data from. dirCache, DirCacheBuilder Builder for Dircache to write new data to. dirCacheBuilder, File The file to update with new contents. Null for inCore usage. f, FileHeader The patch header. fh, PatchApplier.The patch application result. resultApplies patch to a single file. |
| private PatchApplier. | Returns: a loader for the new content, or null if invalid.pathname of the file to write. path, File destination file f, FileHeader the patch to apply fh, DirCacheCheckout.a supplier for the contents of the old file inputSupplier,SHA1 for the old content id, PatchApplier.The patch application result resultApplies a binary patch. |
| public PatchApplier. | |
| private PatchApplier. | |
| private ByteBuffer | |
| private boolean | |
| private boolean | checkOid(ObjectId baseId, ObjectId id, DiffEntry.
|
| private boolean | |
| private InputStream | filterClean(Repository repository, String path, InputStream fromFile, boolean convertCrLf, String filterCommand)
|
| private File | |
| private RawText | Returns: the result raw textto read from file, DirCacheCheckout.if fromTreewalk, the stream of the file content fileStreamSupplier,of the file fileId, String of the file path, boolean whether the file was loaded by a fromTreeWalk, String TreeWalkfor reading the file content filterCommand, boolean whether a CR-LF conversion is needed convertCrLf)Gets the raw text of the given file. |
| private TreeWalk | |
| private static boolean | |
| private ObjectId | |
| private boolean | |
| private DirCacheEntry | insertToIndex(InputStream input, byte[] path, FileMode fileMode, Instant lastModified, long length, Attribute lfsAttribute)
|
| private boolean | |
| private boolean | |
| private ByteBuffer | |
| private static PatchApplier. | |
| private boolean | |
| private boolean |
| allowConflicts | back to summary |
|---|---|
| private boolean allowConflicts | |
| beforeTree | back to summary |
|---|---|
| private final RevTree beforeTree The tree before applying the patch. Only non-null for inCore operation. | |
| charset | back to summary |
|---|---|
| private final Charset charset | |
| FILE_TREE_INDEX | back to summary |
|---|---|
| private static final int FILE_TREE_INDEX | |
| inCoreSizeLimit | back to summary |
|---|---|
| private int inCoreSizeLimit | |
| inserter | back to summary |
|---|---|
| private final ObjectInserter inserter | |
| NO_EOL | back to summary |
|---|---|
| private static final byte[] NO_EOL | |
| reader | back to summary |
|---|---|
| private final ObjectReader reader | |
| repo | back to summary |
|---|---|
| private final Repository repo | |
| workingTreeOptions | back to summary |
|---|---|
| private WorkingTreeOptions workingTreeOptions | |
| PatchApplier | back to summary |
|---|---|
public PatchApplier(Repository repo)
| |
| PatchApplier | back to summary |
|---|---|
public PatchApplier(Repository repo, RevTree beforeTree, ObjectInserter oi)
| |
| allowConflicts | back to summary |
|---|---|
| public PatchApplier allowConflicts() Sets up the
| |
| apply | back to summary |
|---|---|
| private void apply(String pathWithOriginalContent, DirCache dirCache, DirCacheBuilder dirCacheBuilder, File f, FileHeader fh, PatchApplier. Applies patch to a single file.
| |
| applyBinary | back to summary |
|---|---|
| private PatchApplier. Applies a binary patch.
| |
| applyPatch | back to summary |
|---|---|
| public PatchApplier. Applies the given patch
| |
| applyText | back to summary |
|---|---|
private PatchApplier.
| |
| asBytes | back to summary |
|---|---|
| private ByteBuffer asBytes(String str) | |
| canApplyAt | back to summary |
|---|---|
private boolean canApplyAt(List<ByteBuffer> hunkLines, List<ByteBuffer> newLines, int line)
| |
| checkOid | back to summary |
|---|---|
| private boolean checkOid(ObjectId baseId, ObjectId id, DiffEntry. | |
| fileExists | back to summary |
|---|---|
| private boolean fileExists(String path, File f) throws IOException | |
| filterClean | back to summary |
|---|---|
| private InputStream filterClean(Repository repository, String path, InputStream fromFile, boolean convertCrLf, String filterCommand) throws IOException | |
| getFile | back to summary |
|---|---|
| private File getFile(String path) | |
| getRawText | back to summary |
|---|---|
| private RawText getRawText(File file, DirCacheCheckout. Gets the raw text of the given file.
| |
| getTreeWalkForFile | back to summary |
|---|---|
private TreeWalk getTreeWalkForFile(String path, DirCache cache) throws IOException
| |
| hasCrLf | back to summary |
|---|---|
| private static boolean hasCrLf(FileHeader fileHeader) | |
| hash | back to summary |
|---|---|
| private ObjectId hash(File f) throws IOException | |
| inCore | back to summary |
|---|---|
| private boolean inCore() | |
| insertToIndex | back to summary |
|---|---|
| private DirCacheEntry insertToIndex(InputStream input, byte[] path, FileMode fileMode, Instant lastModified, long length, Attribute lfsAttribute) throws IOException | |
| isNoNewlineAtEnd | back to summary |
|---|---|
private boolean isNoNewlineAtEnd(ByteBuffer hunkLine)
| |
| needsCrLfConversion | back to summary |
|---|---|
| private boolean needsCrLfConversion(File f, FileHeader fileHeader) throws IOException | |
| slice | back to summary |
|---|---|
private ByteBuffer slice(ByteBuffer b, int off)
| |
| toContentStreamLoader | back to summary |
|---|---|
| private static PatchApplier. | |
| validGitPath | back to summary |
|---|---|
| private boolean validGitPath(String path) | |
| verifyExistence | back to summary |
|---|---|
| private boolean verifyExistence(FileHeader fh, File src, File dest, PatchApplier. | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv long | |
| pack-priv DirCacheCheckout. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| length | back to summary |
|---|---|
| pack-priv long length | |
| supplier | back to summary |
|---|---|
| pack-priv DirCacheCheckout. | |
| ContentStreamLoader | back to summary |
|---|---|
| pack-priv ContentStreamLoader(DirCacheCheckout. | |
| Modifier and Type | Class and Description |
|---|---|
| public static class | PatchApplier.
A wrapper for a patch applying error that affects a given file. |
| Modifier and Type | Field and Description |
|---|---|
| private List | |
| private List | |
| private ObjectId |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private void | |
| public List | |
| public List | |
| public ObjectId |
| errors | back to summary |
|---|---|
| private List<PatchApplier. | |
| paths | back to summary |
|---|---|
| private List<String> paths | |
| treeId | back to summary |
|---|---|
| private ObjectId treeId | |
| Result | back to summary |
|---|---|
| public Result() | |
| addError | back to summary |
|---|---|
| private void addError(String msg, String oldFileName, HunkHeader hh) | |
| addErrorWithGitConflict | back to summary |
|---|---|
| private void addErrorWithGitConflict(String msg, String oldFileName, HunkHeader hh) | |
| getErrors | back to summary |
|---|---|
| public List Get errors
| |
| getPaths | back to summary |
|---|---|
| public List Get modified paths | |
| getTreeId | back to summary |
|---|---|
| public ObjectId getTreeId() Get tree ID
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final HunkHeader | |
| pack-priv final boolean | |
| pack-priv final String | |
| pack-priv final String |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object
the reference object with which to compare. o)Overrides java. Indicates whether some other object is "equal to" this one. |
| public int | |
| public boolean | Returns: true if conflict markers were added for this
error.Signals if as part of encountering this error, conflict markers were added to the file. |
| public String |
| hh | back to summary |
|---|---|
| pack-priv final HunkHeader hh
| |
| isGitConflict | back to summary |
|---|---|
| pack-priv final boolean isGitConflict | |
| msg | back to summary |
|---|---|
| pack-priv final String msg | |
| oldFileName | back to summary |
|---|---|
| pack-priv final String oldFileName | |
| Error | back to summary |
|---|---|
| pack-priv Error(String msg, String oldFileName, HunkHeader hh, boolean isGitConflict) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| isGitConflict | back to summary |
|---|---|
| public boolean isGitConflict() Signals if as part of encountering this error, conflict markers were added to the file.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
InputStream that updates a SHA1 on every byte read.
| Modifier and Type | Field and Description |
|---|---|
| private final SHA1 | |
| private final InputStream |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Overrides java. Implements java. Closes this input stream and releases any system resources associated with the stream. |
| public SHA1 | |
| public int | read()
Implements abstract java. Reads the next byte of data from the input stream. |
| public int | read(byte[]
the buffer into which the data is read. b, int the start offset in array off, int b
at which the data is written.the maximum number of bytes to read. len)Overrides java. Reads up to |
| hash | back to summary |
|---|---|
| private final SHA1 hash | |
| in | back to summary |
|---|---|
| private final InputStream in | |
| SHA1InputStream | back to summary |
|---|---|
| pack-priv SHA1InputStream(InputStream in, long size) | |
| close | back to summary |
|---|---|
| public void close() throws IOException Overrides java. Implements java. Doc from java. Closes this input stream and releases any system resources associated with the stream.
| |
| getHash | back to summary |
|---|---|
| public SHA1 getHash() | |
| read | back to summary |
|---|---|
| public int read() throws IOException Implements abstract java. Doc from java. Reads the next byte of data from the input stream. The value byte is
returned as an
| |
| read | back to summary |
|---|---|
| public int read(byte[] b, int off, int len) throws IOException Overrides java. Doc from java. Reads up to This method blocks until input data is available, end of file is detected, or an exception is thrown. If The first byte read is stored into element In every case, elements
| |