擅长:python、mysql、java
<p>现在可以使用方法^{cd1>},因为<a href="http://www.samba.org/~jelmer/dulwich/docs/#changelog" rel="nofollow">release 0.8.4</a>。在</p>
<p>它将树同时写入索引文件和文件系统(工作副本),这是一种非常基本的签出形式。在</p>
<p>见注释</p>
<blockquote>
<p>existing index is wiped and contents are not merged
in a working dir. Suiteable only for fresh clones</p>
</blockquote>
<p>我可以用下面的代码让它工作</p>
<pre><code>from dulwich import index, repo
#get repository object of current directory
repo = repo.Repo('.')
indexfile = repo.index_path()
#we want to checkout HEAD
tree = repo["HEAD"].tree
index.build_index_from_tree(repo.path, indexfile, repo.object_store, tree)
</code></pre>