dulwich-users team mailing list archive
-
dulwich-users team
-
Mailing list archive
-
Message #00009
Re: Fetch a specific revision of a file
On Fri, 2009-11-20 at 15:25 +0100, Emiliano Heyns wrote:
> On Wed, Nov 18, 2009 at 20:45, Jelmer Vernooij <jelmer@xxxxxxxxx>
> wrote:
>
> On Wed, 2009-11-18 at 20:16 +0100, Emiliano Heyns wrote:
> > On Wed, Nov 18, 2009 at 16:09, Jelmer Vernooij
> <jelmer@xxxxxxxxx>
> > wrote:
> >
> > On Wed, 2009-11-18 at 14:13 +0100, Emiliano Heyns
> wrote:
> > > I've gotten this far:
> > >
> > > from dulwich.repo import Repo
> > > from dulwich import object_store as GitObjectStore
> > >
> > > repo = Repo(GITREPODIR)
> > > for commit in repo.revision_history(repo.head()):
> > > print commit.commit_time
> > > for id, name, sha in
> repo.tree(commit.tree).entries():
> > > print name, sha
> > > GitObjectStore.tree_lookup_path(??,
> commit.tree,
> > name)
> > >
> > > But I don't know what to use for the first
> parameter for
> > > tree_lookup_path.
> >
> > You want repo.object_store there.
> >
> >
> > When I do that I get:
> >
> > File
> "/usr/lib/python2.6/dist-packages/dulwich/object_store.py",
> > line 477, in tree_lookup_path
> > obj = lookup_obj(sha)
> > TypeError: 'DiskObjectStore' object is not callable
> >
> > I'm on dulwich 0.3.3-1, as provided by Ubuntu. Should I
> upgrade?
>
> Sorry, I meant repo.object_store.__getitem__
>
>
> This works, thanks!
>
> The code above only lists objects in the root directory. I had
> expected entries() to return the entire tree, can I make it recurse
> (or walk the dir myself)?
You should be able to walk the tree yourself. IIRC there aren't any
convenience functions for that. It should be fairly trivial though.
Cheers,
Jelmer
References