use chars like +,-,... for diff_delta_t in Patch.status
This commit is contained in:
@@ -62,7 +62,7 @@ diff_get_patch_byindex(git_diff_list* list, size_t idx)
|
|||||||
if (py_patch != NULL) {
|
if (py_patch != NULL) {
|
||||||
py_patch->old_file_path = delta->old_file.path;
|
py_patch->old_file_path = delta->old_file.path;
|
||||||
py_patch->new_file_path = delta->new_file.path;
|
py_patch->new_file_path = delta->new_file.path;
|
||||||
py_patch->status = delta->status;
|
py_patch->status = git_diff_status_char(delta->status);
|
||||||
py_patch->similarity = delta->similarity;
|
py_patch->similarity = delta->similarity;
|
||||||
py_patch->old_oid = git_oid_allocfmt(&delta->old_file.oid);
|
py_patch->old_oid = git_oid_allocfmt(&delta->old_file.oid);
|
||||||
py_patch->new_oid = git_oid_allocfmt(&delta->new_file.oid);
|
py_patch->new_oid = git_oid_allocfmt(&delta->new_file.oid);
|
||||||
@@ -126,7 +126,7 @@ PyMemberDef Patch_members[] = {
|
|||||||
MEMBER(Patch, new_file_path, T_STRING, "new file path"),
|
MEMBER(Patch, new_file_path, T_STRING, "new file path"),
|
||||||
MEMBER(Patch, old_oid, T_STRING, "old oid"),
|
MEMBER(Patch, old_oid, T_STRING, "old oid"),
|
||||||
MEMBER(Patch, new_oid, T_STRING, "new oid"),
|
MEMBER(Patch, new_oid, T_STRING, "new oid"),
|
||||||
MEMBER(Patch, status, T_INT, "status"),
|
MEMBER(Patch, status, T_CHAR, "status"),
|
||||||
MEMBER(Patch, similarity, T_INT, "similarity"),
|
MEMBER(Patch, similarity, T_INT, "similarity"),
|
||||||
MEMBER(Patch, hunks, T_OBJECT, "hunks"),
|
MEMBER(Patch, hunks, T_OBJECT, "hunks"),
|
||||||
{NULL}
|
{NULL}
|
||||||
|
@@ -329,15 +329,6 @@ moduleinit(PyObject* m)
|
|||||||
ADD_CONSTANT_INT(m, GIT_DIFF_FIND_COPIES_FROM_UNMODIFIED)
|
ADD_CONSTANT_INT(m, GIT_DIFF_FIND_COPIES_FROM_UNMODIFIED)
|
||||||
/* --break-rewrites=/M */
|
/* --break-rewrites=/M */
|
||||||
ADD_CONSTANT_INT(m, GIT_DIFF_FIND_AND_BREAK_REWRITES)
|
ADD_CONSTANT_INT(m, GIT_DIFF_FIND_AND_BREAK_REWRITES)
|
||||||
/* Flags for diff deltas */
|
|
||||||
ADD_CONSTANT_INT(m, GIT_DELTA_UNMODIFIED)
|
|
||||||
ADD_CONSTANT_INT(m, GIT_DELTA_ADDED)
|
|
||||||
ADD_CONSTANT_INT(m, GIT_DELTA_DELETED)
|
|
||||||
ADD_CONSTANT_INT(m, GIT_DELTA_MODIFIED)
|
|
||||||
ADD_CONSTANT_INT(m, GIT_DELTA_RENAMED)
|
|
||||||
ADD_CONSTANT_INT(m, GIT_DELTA_COPIED)
|
|
||||||
ADD_CONSTANT_INT(m, GIT_DELTA_IGNORED)
|
|
||||||
ADD_CONSTANT_INT(m, GIT_DELTA_UNTRACKED)
|
|
||||||
|
|
||||||
/* Config */
|
/* Config */
|
||||||
INIT_TYPE(ConfigType, NULL, PyType_GenericNew)
|
INIT_TYPE(ConfigType, NULL, PyType_GenericNew)
|
||||||
|
@@ -111,7 +111,7 @@ typedef struct {
|
|||||||
const char * new_file_path;
|
const char * new_file_path;
|
||||||
char* old_oid;
|
char* old_oid;
|
||||||
char* new_oid;
|
char* new_oid;
|
||||||
unsigned status;
|
char status;
|
||||||
unsigned similarity;
|
unsigned similarity;
|
||||||
} Patch;
|
} Patch;
|
||||||
|
|
||||||
|
@@ -219,9 +219,9 @@ class DiffTest(utils.BareRepoTestCase):
|
|||||||
#~ Must pass GIT_DIFF_INCLUDE_UNMODIFIED if you expect to emulate
|
#~ Must pass GIT_DIFF_INCLUDE_UNMODIFIED if you expect to emulate
|
||||||
#~ --find-copies-harder during rename transformion...
|
#~ --find-copies-harder during rename transformion...
|
||||||
diff = commit_a.tree.diff(commit_b.tree, GIT_DIFF_INCLUDE_UNMODIFIED)
|
diff = commit_a.tree.diff(commit_b.tree, GIT_DIFF_INCLUDE_UNMODIFIED)
|
||||||
self.assertAll(lambda x: x.status is not pygit2.GIT_DELTA_RENAMED, diff)
|
self.assertAll(lambda x: x.status != 'R', diff)
|
||||||
diff.find_similar()
|
diff.find_similar()
|
||||||
self.assertAny(lambda x: x.status is pygit2.GIT_DELTA_RENAMED, diff)
|
self.assertAny(lambda x: x.status == 'R', diff)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Reference in New Issue
Block a user