Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parents in commit has length 0 #9

Open
gvangool opened this issue Oct 4, 2009 · 1 comment
Open

parents in commit has length 0 #9

gvangool opened this issue Oct 4, 2009 · 1 comment

Comments

@gvangool
Copy link

gvangool commented Oct 4, 2009

When calling repo.get_recent_commits(), I get an error when it reaches the first commit.

In [1]: from pyvcs.backends import get_backend

In [2]: repo = get_backend('git').Repository('.')

In [3]: repo.get_recent_commits()
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)

/home/gvangool/dev/django-vcs-wiki/<ipython console> in <module>()

/home/gvangool/env/generic/lib/python2.6/site-packages/pyvcs/backends/git.pyc in get_recent_commits(self, since)
    101             pending_commits.extend(commit.parents)
    102         commits = filter(lambda o: datetime.fromtimestamp(o.commit_time) >= since, history.values())
--> 103         commits = map(lambda o: self.get_commit_by_id(o.id), commits)
    104         return sorted(commits, key=attrgetter('time'), reverse=True)
    105

/home/gvangool/env/generic/lib/python2.6/site-packages/pyvcs/backends/git.pyc in <lambda>(o)
    101             pending_commits.extend(commit.parents)
    102         commits = filter(lambda o: datetime.fromtimestamp(o.commit_time) >= since, history.values())
--> 103         commits = map(lambda o: self.get_commit_by_id(o.id), commits)
    104         return sorted(commits, key=attrgetter('time'), reverse=True)
    105

/home/gvangool/env/generic/lib/python2.6/site-packages/pyvcs/backends/git.pyc in get_commit_by_id(self, commit_id)
     80     def get_commit_by_id(self, commit_id):
     81         commit = self._get_commit(commit_id)
---> 82         files = self._diff_files(commit.id, commit.parents[0])
     83         return Commit(commit.id, commit.committer,
     84             datetime.fromtimestamp(commit.commit_time), commit.message, files,

IndexError: list index out of range

Easiest way to reproduce is create a new (git) repository and make a couple of commits.

@alex
Copy link
Owner

alex commented Oct 4, 2009

This issue is caused by trying to access the first commit in a repository. I'll have to think of the right way to solve this as we still want to have a correct diff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants