@@ -637,47 +637,10 @@ Repository_merge_base(Repository *self, PyObject *args)
637637}
638638
639639PyDoc_STRVAR (Repository_merge_analysis__doc__ ,
640- "merge_analysis(id) -> (Integer, Integer)\n"
641- "\n"
642- "Analyzes the given branch and determines the opportunities for merging\n"
643- "them into the HEAD of the repository\n"
644- "\n"
645- "The first returned value is a mixture of the GIT_MERGE_ANALYSIS_NONE, _NORMAL,\n"
646- "_UP_TO_DATE, _FASTFORWARD and _UNBORN flags.\n"
647- "The second value is the user's preference from 'merge.ff'" );
648-
649- PyObject *
650- Repository_merge_analysis (Repository * self , PyObject * py_id )
651- {
652- int err ;
653- size_t len ;
654- git_oid id ;
655- git_annotated_commit * commit ;
656- git_merge_analysis_t analysis ;
657- git_merge_preference_t preference ;
658-
659- len = py_oid_to_git_oid (py_id , & id );
660- if (len == 0 )
661- return NULL ;
662-
663- err = git_annotated_commit_lookup (& commit , self -> repo , & id );
664- if (err < 0 )
665- return Error_set (err );
666-
667- err = git_merge_analysis (& analysis , & preference , self -> repo , (const git_annotated_commit * * ) & commit , 1 );
668- git_annotated_commit_free (commit );
669-
670- if (err < 0 )
671- return Error_set (err );
672-
673- return Py_BuildValue ("(ii)" , analysis , preference );
674- }
675-
676- PyDoc_STRVAR (Repository_merge_analysis_for_ref__doc__ ,
677- "merge_analysis_for_ref(our_ref, their_head) -> (Integer, Integer)\n"
640+ "merge_analysis(their_head, our_ref='HEAD') -> (Integer, Integer)\n"
678641 "\n"
679642 "Analyzes the given branch and determines the opportunities for\n"
680- "merging it into a reference.\n"
643+ "merging it into a reference (defaults to HEAD) .\n"
681644 "\n"
682645 "Parameters:\n"
683646 "\n"
@@ -692,9 +655,9 @@ PyDoc_STRVAR(Repository_merge_analysis_for_ref__doc__,
692655 "The second value is the user's preference from 'merge.ff'" );
693656
694657PyObject *
695- Repository_merge_analysis_for_ref (Repository * self , PyObject * args )
658+ Repository_merge_analysis (Repository * self , PyObject * args )
696659{
697- char * our_ref_name = NULL ;
660+ char * our_ref_name = "HEAD" ;
698661 PyObject * py_their_head ;
699662 PyObject * py_result = NULL ;
700663 git_oid head_id ;
@@ -704,9 +667,9 @@ Repository_merge_analysis_for_ref(Repository *self, PyObject *args)
704667 git_merge_preference_t preference ;
705668 int err = 0 ;
706669
707- if (!PyArg_ParseTuple (args , "zO " ,
708- & our_ref_name ,
709- & py_their_head ))
670+ if (!PyArg_ParseTuple (args , "O|z " ,
671+ & py_their_head ,
672+ & our_ref_name ))
710673 return NULL ;
711674
712675 err = git_reference_lookup (& our_ref , self -> repo , our_ref_name );
@@ -2009,8 +1972,7 @@ PyMethodDef Repository_methods[] = {
20091972 METHOD (Repository , walk , METH_VARARGS ),
20101973 METHOD (Repository , descendant_of , METH_VARARGS ),
20111974 METHOD (Repository , merge_base , METH_VARARGS ),
2012- METHOD (Repository , merge_analysis , METH_O ),
2013- METHOD (Repository , merge_analysis_for_ref , METH_VARARGS ),
1975+ METHOD (Repository , merge_analysis , METH_VARARGS ),
20141976 METHOD (Repository , merge , METH_O ),
20151977 METHOD (Repository , cherrypick , METH_O ),
20161978 METHOD (Repository , apply , METH_O ),
0 commit comments