New DiffFile members: size, flags and mode

This commit is contained in:
J. David Ibáñez
2015-03-16 18:17:06 +01:00
parent e32df6a1c8
commit b2ffc8a8d5
3 changed files with 14 additions and 0 deletions

View File

@@ -73,6 +73,9 @@ wrap_diff_file(const git_diff_file *file)
if (py_file) { if (py_file) {
py_file->id = git_oid_to_python(&file->id); py_file->id = git_oid_to_python(&file->id);
py_file->path = file->path != NULL ? strdup(file->path) : NULL; py_file->path = file->path != NULL ? strdup(file->path) : NULL;
py_file->size = file->size;
py_file->flags = file->flags;
py_file->mode = file->mode;
} }
return (PyObject *) py_file; return (PyObject *) py_file;
@@ -169,6 +172,9 @@ DiffFile_dealloc(DiffFile *self)
PyMemberDef DiffFile_members[] = { PyMemberDef DiffFile_members[] = {
MEMBER(DiffFile, id, T_OBJECT, "Oid of the item."), MEMBER(DiffFile, id, T_OBJECT, "Oid of the item."),
MEMBER(DiffFile, path, T_STRING, "Path to the entry."), MEMBER(DiffFile, path, T_STRING, "Path to the entry."),
MEMBER(DiffFile, size, T_LONG, "Size of the entry."),
MEMBER(DiffFile, flags, T_UINT, "Combination of GIT_DIFF_FLAG_* flags."),
MEMBER(DiffFile, mode, T_USHORT, "Mode of the entry."),
{NULL} {NULL}
}; };

View File

@@ -341,6 +341,11 @@ moduleinit(PyObject* m)
/* --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)
/* DiffFile.flags */
ADD_CONSTANT_INT(m, GIT_DIFF_FLAG_BINARY)
ADD_CONSTANT_INT(m, GIT_DIFF_FLAG_NOT_BINARY)
ADD_CONSTANT_INT(m, GIT_DIFF_FLAG_VALID_ID)
/* Config */ /* Config */
ADD_CONSTANT_INT(m, GIT_CONFIG_LEVEL_LOCAL); ADD_CONSTANT_INT(m, GIT_CONFIG_LEVEL_LOCAL);
ADD_CONSTANT_INT(m, GIT_CONFIG_LEVEL_GLOBAL); ADD_CONSTANT_INT(m, GIT_CONFIG_LEVEL_GLOBAL);

View File

@@ -118,6 +118,9 @@ typedef struct {
PyObject_HEAD PyObject_HEAD
PyObject *id; PyObject *id;
char *path; char *path;
git_off_t size;
uint32_t flags;
uint16_t mode;
} DiffFile; } DiffFile;
typedef struct { typedef struct {