File tree 2 files changed +13
-5
lines changed
2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -626,13 +626,13 @@ Repository_merge(Repository *self, PyObject *py_oid)
626
626
}
627
627
628
628
PyDoc_STRVAR (Repository_walk__doc__ ,
629
- "walk(oid, sort_mode) -> iterator\n"
629
+ "walk(oid[ , sort_mode] ) -> iterator\n"
630
630
"\n"
631
631
"Generator that traverses the history starting from the given commit.\n"
632
632
"The following types of sorting could be used to control traversing\n"
633
633
"direction:\n"
634
634
"\n"
635
- "* GIT_SORT_NONE. This is the default sorting for new walkers\n"
635
+ "* GIT_SORT_NONE. This is the default sorting for new walkers. \n"
636
636
" Sort the repository contents in no particular ordering\n"
637
637
"* GIT_SORT_TOPOLOGICAL. Sort the repository contents in topological order\n"
638
638
" (parents before children); this sorting mode can be combined with\n"
@@ -656,13 +656,13 @@ PyObject *
656
656
Repository_walk (Repository * self , PyObject * args )
657
657
{
658
658
PyObject * value ;
659
- unsigned int sort ;
659
+ unsigned int sort = GIT_SORT_NONE ;
660
660
int err ;
661
661
git_oid oid ;
662
662
git_revwalk * walk ;
663
663
Walker * py_walker ;
664
664
665
- if (!PyArg_ParseTuple (args , "OI " , & value , & sort ))
665
+ if (!PyArg_ParseTuple (args , "O|I " , & value , & sort ))
666
666
return NULL ;
667
667
668
668
err = git_revwalk_new (& walk , self -> repo );
Original file line number Diff line number Diff line change 31
31
from __future__ import unicode_literals
32
32
import unittest
33
33
34
- from pygit2 import GIT_SORT_TIME , GIT_SORT_REVERSE
34
+ from pygit2 import GIT_SORT_NONE , GIT_SORT_TIME , GIT_SORT_REVERSE
35
35
from . import utils
36
36
37
37
@@ -107,5 +107,13 @@ def test_simplify_first_parent(self):
107
107
walker .simplify_first_parent ()
108
108
self .assertEqual (len (list (walker )), 3 )
109
109
110
+ def test_default_sorting (self ):
111
+ walker = self .repo .walk (log [0 ], GIT_SORT_NONE )
112
+ list1 = list ([x .id for x in walker ])
113
+ walker = self .repo .walk (log [0 ])
114
+ list2 = list ([x .id for x in walker ])
115
+
116
+ self .assertEqual (list1 , list2 )
117
+
110
118
if __name__ == '__main__' :
111
119
unittest .main ()
You can’t perform that action at this time.
0 commit comments