librelist archives

« back to archive

Simulating git log

Simulating git log

From:
David Catmull
Date:
2013-03-01 @ 18:14
I'm trying to get something like the result of "git log --all 
--topo-order", to make a list of commits something like what you see in 
gitk. I'm using a rev walker with 
GTEnumeratorOptionsTopologicalSort, but the ordering is not the same - in 
some cases, older branches come up first. For example, in libgit2, the 
filename-containing-bracket branch comes out first, and master appears 
below the whole gh-pages branch. Is there a way to get more desirable 
sorting? Does it matter in what order I push things onto the rev walker? 
Or am I going to have to fix up the ordering manually?

Thanks,
David

Re: [libgit2] Simulating git log

From:
Carlos Martïn Nieto
Date:
2013-03-01 @ 19:43
On Fri, 2013-03-01 at 11:14 -0700, David Catmull wrote:
> I'm trying to get something like the result of "git log --all
> --topo-order", to make a list of commits something like what you see
> in gitk. I'm using a rev walker with 
> GTEnumeratorOptionsTopologicalSort, but the ordering is not the same -
> in some cases, older branches come up first. For example, in libgit2,

Topological sort means that children always come before their parents,
nothing else. There are many topological sorts for any given graph. You
might want to combine it with time-based sorting to get what you expect.

   cmn





Re: [libgit2] Simulating git log

From:
David Catmull
Date:
2013-03-01 @ 21:03
On Mar 1, 2013, at 12:43 PM, "Carlos Martïn Nieto" <cmn@dwim.me> wrote:
> Topological sort means that children always come before their parents,
> nothing else. There are many topological sorts for any given graph. You
> might want to combine it with time-based sorting to get what you expect.

I tried with and without time sort, but it didn't affect which branches 
came up first, just the sorting of commits within branches.

Re: [libgit2] Simulating git log

From:
Thomas Rast
Date:
2013-04-02 @ 07:31
David Catmull <uncommon@uncommonplace.com> writes:

> On Mar 1, 2013, at 12:43 PM, "Carlos Martïn Nieto" <cmn@dwim.me> wrote:
>> Topological sort means that children always come before their parents,
>> nothing else. There are many topological sorts for any given graph. You
>> might want to combine it with time-based sorting to get what you expect.
>
> I tried with and without time sort, but it didn't affect which
> branches came up first, just the sorting of commits within branches.

I think with git's --topo-order, the *choice* of topo sort is
essentially arbitrary (and a huge headache if you want to modify the
rev-list loop).

Try comparing git's --date-order with a topo-and-date-sorted walk.  That
one should be consistent modulo date collisions.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch