Update to latest libgit2

This commit is contained in:
Carlos Martín Nieto
2014-06-07 21:31:47 +02:00
parent b1bacdd8d5
commit 491e352e41
3 changed files with 19 additions and 9 deletions

View File

@@ -220,6 +220,13 @@ typedef struct git_checkout_options {
const char *their_label;
} git_checkout_options;
typedef enum {
GIT_CLONE_LOCAL_AUTO,
GIT_CLONE_LOCAL,
GIT_CLONE_NO_LOCAL,
GIT_CLONE_LOCAL_NO_LINKS,
} git_clone_local_t;
typedef struct git_clone_options {
unsigned int version;
@@ -228,6 +235,7 @@ typedef struct git_clone_options {
int bare;
int ignore_cert_errors;
git_clone_local_t local;
const char *remote_name;
const char* checkout_branch;
git_signature *signature;

View File

@@ -546,13 +546,14 @@ Repository_merge_base(Repository *self, PyObject *args)
}
PyDoc_STRVAR(Repository_merge_analysis__doc__,
"merge_analysis(id) -> Integer\n"
"merge_analysis(id) -> (Integer, Integer)\n"
"\n"
"Analyzes the given branch and determines the opportunities for merging\n"
"them into the HEAD of the repository\n"
"\n"
"The returned value is a mixture of the GIT_MERGE_ANALYSIS_NONE, _NORMAL,\n"
" _UP_TO_DATE, _FASTFORWARD and _UNBORN flags");
"The first returned value is a mixture of the GIT_MERGE_ANALYSIS_NONE, _NORMAL,\n"
" _UP_TO_DATE, _FASTFORWARD and _UNBORN flags.\n"
"The second value is the user's preference from 'merge.ff'");
PyObject *
Repository_merge_analysis(Repository *self, PyObject *py_id)
@@ -562,6 +563,7 @@ Repository_merge_analysis(Repository *self, PyObject *py_id)
git_oid id;
git_merge_head *merge_head;
git_merge_analysis_t analysis;
git_merge_preference_t preference;
len = py_oid_to_git_oid(py_id, &id);
if (len == 0)
@@ -571,13 +573,13 @@ Repository_merge_analysis(Repository *self, PyObject *py_id)
if (err < 0)
return Error_set(err);
err = git_merge_analysis(&analysis, self->repo, (const git_merge_head **) &merge_head, 1);
err = git_merge_analysis(&analysis, &preference, self->repo, (const git_merge_head **) &merge_head, 1);
git_merge_head_free(merge_head);
if (err < 0)
return Error_set(err);
return PyLong_FromLong(analysis);
return Py_BuildValue("(ii)", analysis, preference);
}
PyDoc_STRVAR(Repository_merge__doc__,

View File

@@ -313,7 +313,7 @@ class RepositoryTest_III(utils.RepoTestCaseForMerging):
def test_merge_analysis_uptodate(self):
branch_head_hex = '5ebeeebb320790caf276b9fc8b24546d63316533'
branch_id = self.repo.get(branch_head_hex).id
analysis = self.repo.merge_analysis(branch_id)
analysis, preference = self.repo.merge_analysis(branch_id)
self.assertTrue(analysis & GIT_MERGE_ANALYSIS_UP_TO_DATE)
self.assertFalse(analysis & GIT_MERGE_ANALYSIS_FASTFORWARD)
@@ -322,7 +322,7 @@ class RepositoryTest_III(utils.RepoTestCaseForMerging):
def test_merge_analysis_fastforward(self):
branch_head_hex = 'e97b4cfd5db0fb4ebabf4f203979ca4e5d1c7c87'
branch_id = self.repo.get(branch_head_hex).id
analysis = self.repo.merge_analysis(branch_id)
analysis, preference = self.repo.merge_analysis(branch_id)
self.assertFalse(analysis & GIT_MERGE_ANALYSIS_UP_TO_DATE)
self.assertTrue(analysis & GIT_MERGE_ANALYSIS_FASTFORWARD)
self.assertEqual({}, self.repo.status())
@@ -330,7 +330,7 @@ class RepositoryTest_III(utils.RepoTestCaseForMerging):
def test_merge_no_fastforward_no_conflicts(self):
branch_head_hex = '03490f16b15a09913edb3a067a3dc67fbb8d41f1'
branch_id = self.repo.get(branch_head_hex).id
analysis= self.repo.merge_analysis(branch_id)
analysis, preference = self.repo.merge_analysis(branch_id)
self.assertFalse(analysis & GIT_MERGE_ANALYSIS_UP_TO_DATE)
self.assertFalse(analysis & GIT_MERGE_ANALYSIS_FASTFORWARD)
# Asking twice to assure the reference counting is correct
@@ -341,7 +341,7 @@ class RepositoryTest_III(utils.RepoTestCaseForMerging):
branch_head_hex = '1b2bae55ac95a4be3f8983b86cd579226d0eb247'
branch_id = self.repo.get(branch_head_hex).id
analysis = self.repo.merge_analysis(branch_id)
analysis, preference = self.repo.merge_analysis(branch_id)
self.assertFalse(analysis & GIT_MERGE_ANALYSIS_UP_TO_DATE)
self.assertFalse(analysis & GIT_MERGE_ANALYSIS_FASTFORWARD)