dulwich-users team mailing list archive
-
dulwich-users team
-
Mailing list archive
-
Message #00517
Re: Using dulwich for merges and conflict detection
On Tue, 2011-06-07 at 15:38 +0100, arkaitzj@xxxxxxxxx wrote:
> Hi,
> Nope, no reason for fastimport/export, its just the only place I saw
> something that looked like commit(commit).
>
> So, I have the repo, and I have the list of commits(in other branches)
> that I want already extracted from the repo with dulwich. Now, how do
> I combine my Repo() object, my [Commit()] list and a merge algo(I
> guess I also need one) to merge all those commits to
> 'refs/heads/master'.
> Where would I plug the merge algo to get those commits merged into my
> base ref?
You can get the commits and tree objects from the repo object; e.g.:
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.
Cheers,
Jelmer
> Arkaitz
>
>
> On Tue, Jun 7, 2011 at 3:34 PM, Jelmer Vernooij <jelmer@xxxxxxxxx>
> wrote:
> Hi,
>
> On Tue, 2011-06-07 at 15:19 +0100, arkaitzj@xxxxxxxxx wrote:
> > I am evaluating dulwich for a project I have, I just need to
> handle a
> > local repo where people do commits.
> >
> > I want to be able to check if different branches merge
> cleanly and to
> > actually do the merge. I know the software works basically
> at the data
> > model level and i've been able to extract the commits
> between the
> > different refs I need, I just can't find a way of start
> applying all
> > those commits into the base one and see if they succeed or
> not.
>
> > I've been looking at the exporter/importer for this but
> haven't been
> > able to find a way as things like emit_commit do not
> actually commit
> > anything and I am unable to find how to do it with the text
> stream
> > that comes out of the exporter.
>
> Is there a particular reason you've been looking at the
> exporter/importer? Is your initial data in
> fastimport/fastexport?
>
> If you have an existing git repository you should be able to
> open it
> with dulwich.repo.Repo and then get whatever objects from it
> that you
> need; you can then just use them in memory without having to
> write to
> the repository.
>
> It should be quite easy to create objects that aren't in a
> database
> using the classes in dulwich.objects. If you do want to use a
> fastimport
> stream to import existing data, you can import into a
> MemoryObjectStore
> as well, which only exists in memory and does not require any
> data on
> disk.
>
> The main problem I see is that dulwich doesn't have a merge
> implementation at the moment; are you using something else for
> the
> merges?
>
> Cheers,
>
> Jelmer
>
Attachment:
signature.asc
Description: This is a digitally signed message part
Follow ups
References