# HG changeset patch # User Patrick Mezard # Date 1304257912 -7200 # Node ID 28085b82f80104eea4091a09ef27fb6d0d807bae # Parent 7d3bd064026268202d3818c08419cb16f702ab70 graphlog: always sort revisions topologically The grapher cannot really handled revisions if they are not emitted in topological order. The previous 'reverse()' revset was not enough to achieve that and was replaced by an explicit sort call for simplicity. The --limit option is now also handled as usual with cmdutil.loglimit() instead of a 'limit' revset. diff -r 7d3bd0640262 -r 28085b82f801 hgext/graphlog.py --- a/hgext/graphlog.py Sun May 01 15:51:48 2011 +0200 +++ b/hgext/graphlog.py Sun May 01 15:51:52 2011 +0200 @@ -288,10 +288,6 @@ revset = ' and '.join(revset) else: revset = 'all()' - # we want reverted revset to build graph - revset = 'reverse(%s)' % revset - if opts['limit']: - revset = 'limit(%s, %s)' % (revset, opts['limit']) return revset def generate(ui, dag, displayer, showparents, edgefn): @@ -318,7 +314,10 @@ check_unsupported_flags(pats, opts) - revs = revrange(repo, [revset(pats, opts)]) + revs = sorted(revrange(repo, [revset(pats, opts)]), reverse=1) + limit = cmdutil.loglimit(opts) + if limit is not None: + revs = revs[:limit] revdag = graphmod.dagwalker(repo, revs) displayer = show_changeset(ui, repo, opts, buffered=True) diff -r 7d3bd0640262 -r 28085b82f801 tests/test-glog.t --- a/tests/test-glog.t Sun May 01 15:51:48 2011 +0200 +++ b/tests/test-glog.t Sun May 01 15:51:52 2011 +0200 @@ -1319,13 +1319,12 @@ file(File) + limit + -ra:b, b < tip: $ hg glog -l1 -r32:34 -r 'file("a")' - o changeset: 31:621d83e11f67 - |\ parent: 21:d42a756af44d - | | parent: 30:6e11cd4b648f - | | user: test - | | date: Thu Jan 01 00:00:31 1970 +0000 - | | summary: (31) expand - | | + o changeset: 34:fea3ac5810e0 + | parent: 32:d06dffa21a31 + | user: test + | date: Thu Jan 01 00:00:34 1970 +0000 + | summary: (34) head + | limit(file(File) and a::b), b < tip: @@ -1457,8 +1456,16 @@ Test multiple revision specifications are correctly handled - $ hg log -G -r 27 -r 25 --branch default --template '{rev}\n' - o 25 + $ hg log -G -r 27 -r 25 -r 21 -r 34 -r 32 -r 31 --template '{rev}\n' + o 34 + | + o 32 |\ - +---o 27 - | | + | o 31 + | |\ + o | | 27 + |/ / + | o 25 + |/ + o 21 + |\