Domanda

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

How can I do that using dulwich?

È stato utile?

Soluzione

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 <test@nodomain.com>',
                             author='Test Author <test@nodomain.com>',
                             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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top