Dulwich: How to automatically stage modified files

385 views Asked by At

In git command line, we can use git commit -a.

How can I do that using dulwich?

1

There are 1 answers

1
VonC On BEST ANSWER

When considering the various tests for a commit, like those in test_repository.py, it doesn't seem to be possible in one line:

    r.stage(['a'])
    commit_sha = r.do_commit('modified a',
                             committer='Test Committer <[email protected]>',
                             author='Test Author <[email protected]>',
                             commit_timestamp=12395, commit_timezone=0,
                             author_timestamp=12395, author_timezone=0)

You need to find modified or deleted files first, and stage them, before calling the commit.

The other alternative would be to use git-python, which is a wrapper to git, but it doesn't offer either that feature out of the box.