Classes for dealing with git am-style patches.
These patches are basically unified diffs with some extra metadata tacked on.
Function | gen |
Write a blob diff header. |
Function | get |
Determine the summary line for use in a filename. |
Function | git |
Parse a git-am-style patch and split it up into bits. |
Function | is |
See if the first few bytes contain any null characters. |
Function | parse |
Extract a Commit object and patch from an e-mail message. |
Function | patch |
Undocumented |
Function | shortid |
Undocumented |
Function | unified |
difflib.unified_diff that can detect "No newline at end of file" as original "git diff" does. |
Function | write |
Write blob diff. |
Function | write |
Write a individual file patch. |
Function | write |
Write the diff for an object. |
Function | write |
Write tree diff. |
Constant | FIRST |
Undocumented |
Function | _format |
Convert range to the "ed" format |
Write a blob diff header.
Parameters | |
paths | Tuple with old and new path |
modes | Tuple with old and new modes |
shas | Tuple with old and new shas |
Parse a git-am-style patch and split it up into bits.
Returns: Tuple with commit object, diff contents and git version
Parameters | |
f | File-like object to parse |
encoding | Encoding to use when creating Git objects |
See if the first few bytes contain any null characters.
Parameters | |
content | Bytestring to check for binary content |
Extract a Commit object and patch from an e-mail message.
Returns: Tuple with commit object, diff contents and git version
Parameters | |
msg | An email message (email.message.Message) |
encoding | Encoding to use to encode Git commits |
difflib.unified_diff that can detect "No newline at end of file" as original "git diff" does.
Based on the same function in Python2.7 difflib.py
Write blob diff.
Note: The use of write_object_diff is recommended over this function.
Parameters | |
f | File-like object to write to |
old | (path, mode, hexsha) tuple (None if nonexisting) |
new | (path, mode, hexsha) tuple (None if nonexisting) |
Write a individual file patch.
Parameters | |
f | Undocumented |
commit | Commit object |
contents | Undocumented |
progress | Tuple with current patch number and total. |
version | Undocumented |
encoding | Undocumented |
Returns | |
tuple with filename and contents |
Write the diff for an object.
Note: the tuple elements should be None for nonexistent files
Parameters | |
f | File-like object to write to |
store | Store to retrieve objects from, if necessary |
old | (path, mode, hexsha) tuple |
new | (path, mode, hexsha) tuple |
diff | Whether to diff files even if they are considered binary files by is_binary(). |