← Back to team overview

dulwich-users team mailing list archive

Re: Using dulwich for merges and conflict detection

 

On Tue, 2011-06-07 at 16:24 +0100, arkaitzj@xxxxxxxxx wrote:
> On Tue, Jun 7, 2011 at 3:53 PM, Jelmer Vernooij <jelmer@xxxxxxxxx>
> wrote:
>         r = Repo("/path/to/repo")
>         c = r[some_commit_id]
>         print c.committer
>         print c.author
>         print c.message
>         root_tree = r[c.tree]
>         (where root Tree is a tree object)
>         
>         As dulwich doesn't include any merge infrastructure, your
>         merge
>         algorithm will have to take it from there.

> Ok, so my merge algo compares head tree vs new commit tree to see if
> its clean or do any merge changes if necessary.
Well, if the tree is the same no merge is necessary (I'm not sure what
you mean by a "clean" merge).

> But, If I have to merge, or change parents, I assume the sha of the
> commit should change, how would this be handled? Say that I take the
> commit, I modify the tree object of the commit and then I want to put
> it somewhere else, so I modify commits parents[] as well, now I would
> need to calculate the new sha1 and push it into the store with
> add_object(), do I need to push the modified tree as well or it goes
> inside the Commit?
If you modify the objects you can then add them to the repository using
Repo.object_store.add_object(s) - dulwich takes care of calculating the
new object sha1.

Cheers,

jelmer

Attachment: signature.asc
Description: This is a digitally signed message part


References