Submitter | Pierre-Yves David |
---|---|
Date | Dec. 2, 2014, 5:29 p.m. |
Message ID | <cd61890c0066b48b428c.1417541363@marginatus.alto.octopoid.net> |
Download | mbox | patch |
Permalink | /patch/6945/ |
State | Accepted |
Commit | 3fa47555d5483355dc0488f8b2574c01f49bca39 |
Headers | show |
Comments
On Tue, Dec 02, 2014 at 09:29:23AM -0800, Pierre-Yves David wrote: > # HG changeset patch > # User Pierre-Yves David <pierre-yves.david@fb.com> > # Date 1415986679 0 > # Fri Nov 14 17:37:59 2014 +0000 > # Node ID cd61890c0066b48b428c8b089c9129e952b88c73 > # Parent d99276796fabf9c8a8cf762d7b0d0927c4560dd4 > graphlog: add a way to test the 'groupbranchiter' function > > We add an experimental config option to use the topological sorting. I first > tried to hook the 'groupbranchiter' function in the 'sort' revset but this was useless > because graphlog enforce revision number sorting :( > > As the goal is to advance on the topological iteration logic, I see this > experimental option as a good way to move forward. > > We have to use turn the iterator into a list because the graphlog is apparently > not ready for pure iterator input yet. > > diff --git a/mercurial/graphmod.py b/mercurial/graphmod.py > --- a/mercurial/graphmod.py > +++ b/mercurial/graphmod.py > @@ -197,10 +197,13 @@ def dagwalker(repo, revs): > > cl = repo.changelog > lowestrev = revs.min() > gpcache = {} > > + if repo.ui.configbool('experimental', 'graph-topological', False): Really really sorry I didn't notice this in an earlier round. Can we rename this too? Perhaps "graph-group-branches" or similar? (Happy to do this as a followup if you'd like - just want consensus on the name of this shed.) > + revs = list(groupbranchiter(revs, repo.changelog.parentrevs)) > + > for rev in revs: > ctx = repo[rev] > parents = sorted(set([p.rev() for p in ctx.parents() > if p.rev() in revs])) > mpars = [p.rev() for p in ctx.parents() if > diff --git a/tests/test-glog-topological.t b/tests/test-glog-topological.t > new file mode 100644 > --- /dev/null > +++ b/tests/test-glog-topological.t > @@ -0,0 +1,58 @@ > +This test file aims at test topological iteration and the various configuration it can has. > + > + $ cat >> $HGRCPATH << EOF > + > [ui] > + > logtemplate={rev}\n > + > EOF > + > +On this simple example, all topological branch are displayed in turn until we > +can finally display 0. this implies skipping from 8 to 3 and coming back to 7 > +later. > + > + $ hg init test01 > + $ cd test01 > + $ hg unbundle $TESTDIR/bundles/remote.hg > + adding changesets > + adding manifests > + adding file changes > + added 9 changesets with 7 changes to 4 files (+1 heads) > + (run 'hg heads' to see heads, 'hg merge' to merge) > + > + $ hg log -G > + o 8 > + | > + | o 7 > + | | > + | o 6 > + | | > + | o 5 > + | | > + | o 4 > + | | > + o | 3 > + | | > + o | 2 > + | | > + o | 1 > + |/ > + o 0 > + > + $ hg --config experimental.graph-topological=1 log -G > + o 8 > + | > + o 3 > + | > + o 2 > + | > + o 1 > + | > + | o 7 > + | | > + | o 6 > + | | > + | o 5 > + | | > + | o 4 > + |/ > + o 0 > + > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@selenic.com > http://selenic.com/mailman/listinfo/mercurial-devel
On 12/08/2014 12:15 PM, Augie Fackler wrote: > On Tue, Dec 02, 2014 at 09:29:23AM -0800, Pierre-Yves David wrote: >> # HG changeset patch >> # User Pierre-Yves David <pierre-yves.david@fb.com> >> # Date 1415986679 0 >> # Fri Nov 14 17:37:59 2014 +0000 >> # Node ID cd61890c0066b48b428c8b089c9129e952b88c73 >> # Parent d99276796fabf9c8a8cf762d7b0d0927c4560dd4 >> graphlog: add a way to test the 'groupbranchiter' function >> >> We add an experimental config option to use the topological sorting. I first >> tried to hook the 'groupbranchiter' function in the 'sort' revset but this was useless >> because graphlog enforce revision number sorting :( >> >> As the goal is to advance on the topological iteration logic, I see this >> experimental option as a good way to move forward. >> >> We have to use turn the iterator into a list because the graphlog is apparently >> not ready for pure iterator input yet. >> >> diff --git a/mercurial/graphmod.py b/mercurial/graphmod.py >> --- a/mercurial/graphmod.py >> +++ b/mercurial/graphmod.py >> @@ -197,10 +197,13 @@ def dagwalker(repo, revs): >> >> cl = repo.changelog >> lowestrev = revs.min() >> gpcache = {} >> >> + if repo.ui.configbool('experimental', 'graph-topological', False): > > Really really sorry I didn't notice this in an earlier round. Can we > rename this too? Perhaps "graph-group-branches" or similar? I though I cleaned it up but apparently failed. > (Happy to do this as a followup if you'd like - just want consensus on > the name of this shed.) Go for it.
Patch
diff --git a/mercurial/graphmod.py b/mercurial/graphmod.py --- a/mercurial/graphmod.py +++ b/mercurial/graphmod.py @@ -197,10 +197,13 @@ def dagwalker(repo, revs): cl = repo.changelog lowestrev = revs.min() gpcache = {} + if repo.ui.configbool('experimental', 'graph-topological', False): + revs = list(groupbranchiter(revs, repo.changelog.parentrevs)) + for rev in revs: ctx = repo[rev] parents = sorted(set([p.rev() for p in ctx.parents() if p.rev() in revs])) mpars = [p.rev() for p in ctx.parents() if diff --git a/tests/test-glog-topological.t b/tests/test-glog-topological.t new file mode 100644 --- /dev/null +++ b/tests/test-glog-topological.t @@ -0,0 +1,58 @@ +This test file aims at test topological iteration and the various configuration it can has. + + $ cat >> $HGRCPATH << EOF + > [ui] + > logtemplate={rev}\n + > EOF + +On this simple example, all topological branch are displayed in turn until we +can finally display 0. this implies skipping from 8 to 3 and coming back to 7 +later. + + $ hg init test01 + $ cd test01 + $ hg unbundle $TESTDIR/bundles/remote.hg + adding changesets + adding manifests + adding file changes + added 9 changesets with 7 changes to 4 files (+1 heads) + (run 'hg heads' to see heads, 'hg merge' to merge) + + $ hg log -G + o 8 + | + | o 7 + | | + | o 6 + | | + | o 5 + | | + | o 4 + | | + o | 3 + | | + o | 2 + | | + o | 1 + |/ + o 0 + + $ hg --config experimental.graph-topological=1 log -G + o 8 + | + o 3 + | + o 2 + | + o 1 + | + | o 7 + | | + | o 6 + | | + | o 5 + | | + | o 4 + |/ + o 0 +