Mercurial > hg
diff hgext/graphlog.py @ 14133:28085b82f801
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.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Sun, 01 May 2011 15:51:52 +0200 |
parents | 7d3bd0640262 |
children | 4e5a36eeefd1 |
line wrap: on
line diff
--- 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)