Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
14132:7d3bd0640262 | 14133:28085b82f801 |
---|---|
286 if optrevset: | 286 if optrevset: |
287 revset.append('(' + ' and '.join(optrevset) + ')') | 287 revset.append('(' + ' and '.join(optrevset) + ')') |
288 revset = ' and '.join(revset) | 288 revset = ' and '.join(revset) |
289 else: | 289 else: |
290 revset = 'all()' | 290 revset = 'all()' |
291 # we want reverted revset to build graph | |
292 revset = 'reverse(%s)' % revset | |
293 if opts['limit']: | |
294 revset = 'limit(%s, %s)' % (revset, opts['limit']) | |
295 return revset | 291 return revset |
296 | 292 |
297 def generate(ui, dag, displayer, showparents, edgefn): | 293 def generate(ui, dag, displayer, showparents, edgefn): |
298 seen, state = [], asciistate() | 294 seen, state = [], asciistate() |
299 for rev, type, ctx, parents in dag: | 295 for rev, type, ctx, parents in dag: |
316 directory. | 312 directory. |
317 """ | 313 """ |
318 | 314 |
319 check_unsupported_flags(pats, opts) | 315 check_unsupported_flags(pats, opts) |
320 | 316 |
321 revs = revrange(repo, [revset(pats, opts)]) | 317 revs = sorted(revrange(repo, [revset(pats, opts)]), reverse=1) |
318 limit = cmdutil.loglimit(opts) | |
319 if limit is not None: | |
320 revs = revs[:limit] | |
322 revdag = graphmod.dagwalker(repo, revs) | 321 revdag = graphmod.dagwalker(repo, revs) |
323 | 322 |
324 displayer = show_changeset(ui, repo, opts, buffered=True) | 323 displayer = show_changeset(ui, repo, opts, buffered=True) |
325 showparents = [ctx.node() for ctx in repo[None].parents()] | 324 showparents = [ctx.node() for ctx in repo[None].parents()] |
326 generate(ui, revdag, displayer, showparents, asciiedges) | 325 generate(ui, revdag, displayer, showparents, asciiedges) |