Skip to content

Instantly share code, notes, and snippets.

@abondis
Last active December 13, 2015 19:28
Show Gist options
  • Save abondis/4962393 to your computer and use it in GitHub Desktop.
Save abondis/4962393 to your computer and use it in GitHub Desktop.
dulwich: move a file in a repo
from dulwich.repo import Repo
r = Repo('/tmp/bunchofrepos/montestgit/')
t = r['HEAD'].tree
T = r.tree(t)
truc_entry = T.lookup_path(r.get_object, 'blah/truc')
truc_tree = r.tree(truc_entry[1])
truc_tree.entries()
truc_tree['new_filename.txt'] = truc_tree['bidule.text']
truc_tree.entries()
del truc_tree['bidule.text']
truc_tree.entries()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment