threads / discuss / 14006

suggestions for generating diffs through the revision list

Subject: suggestions for generating diffs through the revision list

## tl;dr

3 messages between Jun 17, 2008 and Jun 19, 2008.

replies: 2people: 2as markdown or json

Don Zickus· Jun 17, 2008, 21:41 UTC · lore

I am try to walk the revision history for a given path and analyze the diff (as compared to its parent). What is the proper way of doing that?

I noticed a bunch of 'library' calls such as

init_revsion(&revs); setup_revisions(argc, argv, &revs, "HEAD"); prepare_revision_walk(&revs, NULL); commit = get_revision(&revs);

But what I can't find is the way to generate diffs. I see lots and lots of code to do it, but every builtin seems to do it differently. Not knowing the internals that well, I was hoping for some advice.

I stumbled upon calls like

run_diff_files run_diff_index

but I haven't seen how to use them correctly.
Any help would be appreciated.  Thanks.

Cheers, Don

Junio C Hamano· Jun 17, 2008, 22:04 UTC · re: Don Zickus · lore

Re: suggestions for generating diffs through the revision list

Don Zickus <dzickus@redhat.com> writes:
Show 20 quoted lines
> I am try to walk the revision history for a given path and analyze the
> diff (as compared to its parent).  What is the proper way of doing that?
>
> I noticed a bunch of 'library' calls such as
>
> init_revsion(&revs);
> setup_revisions(argc, argv, &revs, "HEAD");
> prepare_revision_walk(&revs, NULL);
> commit = get_revision(&revs);
>
> But what I can't find is the way to generate diffs.  I see lots and lots
> of code to do it, but every builtin seems to do it differently.  Not
> knowing the internals that well, I was hoping for some advice.
>
> I stumbled upon calls like
>
> run_diff_files
> run_diff_index
>
> but I haven't seen how to use them correctly.
Documentation/technical/api-*.txt
Don Zickus· Jun 19, 2008, 21:20 UTC · re: Junio C Hamano · lore

Re: suggestions for generating diffs through the revision list

On Tue, Jun 17, 2008 at 03:04:28PM -0700, Junio C Hamano wrote:
Show 24 quoted lines
> Don Zickus <dzickus@redhat.com> writes:
> 
> > I am try to walk the revision history for a given path and analyze the
> > diff (as compared to its parent).  What is the proper way of doing that?
> >
> > I noticed a bunch of 'library' calls such as
> >
> > init_revsion(&revs);
> > setup_revisions(argc, argv, &revs, "HEAD");
> > prepare_revision_walk(&revs, NULL);
> > commit = get_revision(&revs);
> >
> > But what I can't find is the way to generate diffs.  I see lots and lots
> > of code to do it, but every builtin seems to do it differently.  Not
> > knowing the internals that well, I was hoping for some advice.
> >
> > I stumbled upon calls like
> >
> > run_diff_files
> > run_diff_index
> >
> > but I haven't seen how to use them correctly.
> 
> Documentation/technical/api-*.txt

Hmm. Thanks. I was trying to keep the diffs in memory and I couldn't find anything in the api-*.txt that did anything but dump the output the stdout or a file.

Anyway I just copied a bunch of code from builtin-blame.c and got my tool to do what I wanted it to do, for now.

Cheers, Don

← back to recent threads