The current implementation now runs for 19minutes without returning. This implementation returns after 12 seconds cpu time with the same repository. I am not completely sure that the sorting will be correct (in the extreme case that an older commit has a newer timestamp).
def revision_history(self, head):
"""Returns a list of the commits reachable from head.
Returns a list of commit objects. the first of which will be the commit
of head, then following theat will be the parents.
Raises NotCommitError if any no commits are referenced, including if the
head parameter isn't the sha of a commit.
XXX: work out how to handle merges.
"""
# We build the list backwards, as parents are more likely to be older
# than children
try: pending_commits = [self.commit(head)]
except KeyError:
raise MissingCommitError(head)
The current implementation now runs for 19minutes without returning. This implementation returns after 12 seconds cpu time with the same repository. I am not completely sure that the sorting will be correct (in the extreme case that an older commit has a newer timestamp).
def revision_ history( self, head):
"""Returns a list of the commits reachable from head.
Returns a list of commit objects. the first of which will be the commit
of head, then following theat will be the parents.
Raises NotCommitError if any no commits are referenced, including if the
head parameter isn't the sha of a commit.
XXX: work out how to handle merges.
pending_ commits = [self.commit(head)] ror(head)
"""
# We build the list backwards, as parents are more likely to be older
# than children
try:
except KeyError:
raise MissingCommitEr
all_commits = set()
pending_ commits. sort(key= lambda x:x.commit_time, reverse=True) commits. pop(0)
sorted_commits = []
while pending_commits != []:
commit = pending_
if commit.id in all_commits:
continue
for parent in commit.parents:
try:
except KeyError:
sorted_
return sorted_commits