Programmatically `git status` with dulwich -


i'm wondering how can perform equivalent of git status dulwich?

i tried this:

after adding/changing/renaming files , staging them commit, i've tried doing:

from dulwich.repo  import repo dulwich.index import changes_from_tree r = repo('my-git-repo') index = r.open_index() changes = index.changes_from_tree(r.object_store, r['head'].tree) 

outputs following:

>>> list(changes) (('makefile', none), (33188, none), ('9b20...', none)) (('test/readme.txt', 'test/readme.txt'), (33188, 33188), ('484b...', '4f89...')) ((none, 'makefile.mk'), (none, 33188), (none, '9b20...')) ((none, 'test.txt'), (none, 33188), (none, '2a02...')) 

but output requires further process detect:

  1. i modified readme.txt.
  2. i renamed makefile makefile.mk.
  3. i added test.txt repository.

the functions in dulwich.diff_tree provide nicer interface tree changes... not possible before committing?

you should able use dulwich.diff_tree.tree_changes detect changes between 2 trees.

one of requirements add relevant tree objects object store - can use dulwich.index.commit_index this.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -