First commit and dulwich.diff_tree.tree_changes

Asked by Sasa Stamenkovic

I am iterating repo.get_walker() and for each entry I am getting dulwich.diff_tree.tree_changes(repo, repo[entry.commit.parents[0]].tree, entry.commit.tree). This works well when entry.commit has parents. But first commit has no parents and that's when error occurs. Same happens with write_tree_diff().

What should I use instead entry.commit.parents[0] for first commit (when commit has no parents)?

Question information

Language:
English Edit question
Status:
Solved
For:
Dulwich Edit question
Assignee:
No assignee Edit question
Solved by:
Sasa Stamenkovic
Solved:
Last query:
Last reply:
Revision history for this message
Jelmer Vernooij (jelmer) said :
#1

Use None to diff against nothing at all.

Revision history for this message
Sasa Stamenkovic (umpirsky) said :
#2

That did the trick, thanks!