From: Dave Borowitz <[email protected]>
Change-Id: I1142cb413891a20555ee31fdfde9a7a09d834a57
---
dulwich/walk.py | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/dulwich/walk.py b/dulwich/walk.py
index 5185b6c..a54f52d 100644
--- a/dulwich/walk.py
+++ b/dulwich/walk.py
@@ -254,8 +254,17 @@ class Walker(object):
self._num_entries += 1
return entry
- def __iter__(self):
- results = iter(self._next, None)
+ def _reorder(self, results):
+ """Possibly reorder a results iterator.
+
+ :param results: An iterator of results, in the order returned from the
+ queue_cls.
+ :return: An iterator or list of results, in the order required by the
+ Walker.
+ """
if self.reverse:
results = reversed(list(results))
- return iter(results)
+ return results
+
+ def __iter__(self):
+ return iter(self._reorder(iter(self._next, None)))
--
1.7.3.1
_______________________________________________
Mailing list: https://launchpad.net/~dulwich-users
Post to : [email protected]
Unsubscribe : https://launchpad.net/~dulwich-users
More help : https://help.launchpad.net/ListHelp