Patch.convenientFromDiff
Patch.convenientFromDiff(diff).then(function(stdVectorPatchdata) {
// Use stdVectorPatchdata
});
Parameters | Type | |
---|---|---|
diff | Diff |
Returns | |
---|---|
StdVectorPatchdata |
Patch.fromBlobs
Patch.fromBlobs(old_blob, old_as_path, new_blob, new_as_path, opts).then(function(patch) {
// Use patch
});
Parameters | Type | |
---|---|---|
old_blob | Blob | Blob for old side of diff, or NULL for empty blob |
old_as_path | String | Treat old blob as if it had this filename; can be NULL |
new_blob | Blob | Blob for new side of diff, or NULL for empty blob |
new_as_path | String | Treat new blob as if it had this filename; can be NULL |
opts | DiffOptions | Options for diff, or NULL for default options |
Returns | |
---|---|
Patch | The generated patch; NULL on error |
Patch.fromDiff
Patch.fromDiff(diff, idx).then(function(patch) {
// Use patch
});
Parameters | Type | |
---|---|---|
diff | Diff | Diff list object |
idx | Number | Index into diff list |
Returns | |
---|---|
Patch | Output parameter for the delta patch object |
Patch#getDelta
var diffDelta = patch.getDelta();
Returns | |
---|---|
DiffDelta |
Patch#getHunk
patch.getHunk(hunk_idx).then(function(result) {
// Use result
});
Parameters | Type | |
---|---|---|
hunk_idx | Number | Input index of hunk to get information about |
Returns | |
---|---|
Number | Output count of total lines in this hunk |
Patch#getLineInHunk
patch.getLineInHunk(hunk_idx, line_of_hunk).then(function(diffLine) {
// Use diffLine
});
Parameters | Type | |
---|---|---|
hunk_idx | Number | The index of the hunk |
line_of_hunk | Number | The index of the line in the hunk |
Returns | |
---|---|
DiffLine | The git_diff_line data for this line |
Patch#lineStats
var result = patch.lineStats();
Returns | |
---|---|
Number | Count of deletion lines in output, can be NULL. |
Patch#numHunks
var result = patch.numHunks();
Returns | |
---|---|
Number |
Patch#numLinesInHunk
var result = patch.numLinesInHunk(hunk_idx);
Parameters | Type | |
---|---|---|
hunk_idx | Number | Index of the hunk |
Returns | |
---|---|
Number | Number of lines in hunk or GIT_ENOTFOUND if invalid hunk index |
Patch#size
var result = patch.size(include_context, include_hunk_headers, include_file_headers);
Parameters | Type | |
---|---|---|
include_context | Number | Include context lines in size if non-zero |
include_hunk_headers | Number | Include hunk header lines if non-zero |
include_file_headers | Number | Include file header lines if non-zero |
Returns | |
---|---|
Number | The number of bytes of data |