Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyFile(pristine, patchData []byte) ([]byte, error)
- func ApplyFileWithConflicts(pristine, patchData []byte) ([]byte, error)
- func ApplyPatchOperations(tree map[string][]byte, operations []PatchOperation) (map[string][]byte, error)
- func ApplyPatchset(tree map[string][]byte, patchData []byte) (map[string][]byte, error)
- func SignificantChange(diff string, isSignificant func(*FileDiff, *ContentChange) (bool, string)) (significant bool, msg string, err error)
- type ContentChange
- type ContentChangeType
- type FileDiff
- type FileDiffType
- type PatchOperation
- type PatchOperationType
Constants ¶
const ( ContentChangeTypeAdd = contentChangeTypeAdd ContentChangeTypeDelete = contentChangeTypeDelete ContentChangeTypeModify = contentChangeTypeModify ContentChangeTypeNOOP = contentChangeTypeNOOP FileDiffTypeAdded = fileDiffTypeAdded FileDiffTypeDeleted = fileDiffTypeDeleted FileDiffTypeModified = fileDiffTypeModified )
Variables ¶
var ErrPatchConflict = errors.New("patch conflict")
Functions ¶
func ApplyFileWithConflicts ¶ added in v0.1.0
func ApplyPatchOperations ¶ added in v0.2.0
func ApplyPatchOperations(tree map[string][]byte, operations []PatchOperation) (map[string][]byte, error)
ApplyPatchOperations applies ordered patch operations to a copy of tree.
func ApplyPatchset ¶ added in v0.1.0
func SignificantChange ¶
Types ¶
type ContentChange ¶
type ContentChange = contentChange
type ContentChangeType ¶
type ContentChangeType = contentChangeType
type FileDiffType ¶
type FileDiffType = fileDiffType
type PatchOperation ¶ added in v0.2.0
type PatchOperation struct {
Type PatchOperationType
SourcePath string
TargetPath string
OldMode string
NewMode string
IndexMode string
IsBinary bool
Patch []byte
// contains filtered or unexported fields
}
PatchOperation describes one file-level operation in a git patchset.
Values returned by ParsePatchOperations can be passed to ApplyPatchOperations.
func ParsePatchOperations ¶ added in v0.2.0
func ParsePatchOperations(patchData []byte) ([]PatchOperation, error)
ParsePatchOperations parses patchData into ordered file-level operations.
func (*PatchOperation) MutatesFileSet ¶ added in v0.2.0
func (op *PatchOperation) MutatesFileSet() bool
MutatesFileSet reports whether this operation adds, removes, or moves a file.
type PatchOperationType ¶ added in v0.2.0
type PatchOperationType string
const ( PatchOperationTypeModify PatchOperationType = "modify" PatchOperationTypeCreate PatchOperationType = "create" PatchOperationTypeDelete PatchOperationType = "delete" PatchOperationTypeRename PatchOperationType = "rename" PatchOperationTypeCopy PatchOperationType = "copy" PatchOperationTypeModeChange PatchOperationType = "mode_change" PatchOperationTypeBinary PatchOperationType = "binary" )